From 8214bf2875f59285798e6edd0cb0f8b6c67b61f4 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Mon, 21 Aug 2023 09:16:12 +0100 Subject: [PATCH 001/145] [UR][CTS] Upstream CTS parser --- scripts/ctest_parser.py | 129 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 scripts/ctest_parser.py diff --git a/scripts/ctest_parser.py b/scripts/ctest_parser.py new file mode 100644 index 0000000000..0530290df1 --- /dev/null +++ b/scripts/ctest_parser.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python +""" + Copyright (C) 2022 Intel Corporation + + Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + See LICENSE.TXT + SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +""" + +from sys import argv +from subprocess import PIPE, Popen, STDOUT +import argparse +import os + + +def run(command, env): + process = Popen(command, env=env, stdout=PIPE, + stderr=STDOUT, cwd=command[1]) + lines = process.communicate()[0].decode('utf-8').splitlines() + results = {"Passed": {}, "Skipped": {}, "Failed": {}, 'Total': 0, 'Success': True} + for line in lines: + result_types = ['[ OK ]', '[ FAILED ]', '[ SKIPPED ]'] + if any([x in line for x in result_types]) and line.endswith("ms)"): + name, time = line[line.find(']') + 2:].split(' ', maxsplit=1) + if 'OK' in line: + results['Passed'][name] = {'time': time} + elif 'SKIPPED' in line: + results['Skipped'][name] = {'time': time} + elif 'FAILED' in line: + results['Failed'][name] = {'time': time} + elif '[==========] Running' in line: + # This is the start of a new test suite, get the number of tests in + # the first line e.g: '[==========] Running 29 tests from 9 test suites.' + total = line[line.find('g') + 2:line.find('t') - 1] + results['Total'] += int(total) + + if process.returncode != 0: + results['Success'] = False + + return results + + +def print_results(results, result_type): + print('[CTest Parser] {} tests: '.format(result_type)) + print("\n".join("\t{}\t{}".format(k, v['time']) + for k, v in results.items())) + + +def print_summary(total, total_passed, total_failed, total_skipped, total_crashed): + pass_rate_incl_skipped = str(round((total_passed / total) * 100, 2)) + total_excl_skipped = total - total_skipped + pass_rate_excl_skipped = str( + round((total_passed / total_excl_skipped) * 100, 2)) + + skipped_rate = str(round((total_skipped / total) * 100, 2)) + failed_rate = str(round((total_failed / total) * 100, 2)) + crashed_rate = str(round((total_crashed / total) * 100, 2)) + + print('[CTest Parser] Results:') + print('\tTotal\t[{}]'. format(total)) + print('\tPassed\t[{}]\t({}%) - ({}% with skipped tests excluded)'.format( + total_passed, pass_rate_incl_skipped, pass_rate_excl_skipped)) + print('\tSkipped\t[{}]\t({}%)'.format(total_skipped, skipped_rate)) + print('\tFailed\t[{}]\t({}%)'.format(total_failed, failed_rate)) + print('\tCrashed\t[{}]\t({}%)'.format(total_crashed, crashed_rate)) + + +def dir_path(string): + if os.path.isdir(string): + return string + else: + raise NotADirectoryError(string) + + +def main(): + parser = argparse.ArgumentParser( + description='CTest Result Parser. Parses output from CTest and ' + 'summarises test results. -VV argument is always passed to ' + 'CTest capture full output.') + + parser.add_argument('ctest_path', type=dir_path, nargs='?', default='.', + help='Optional path to test directory containing ' + 'CTestTestfile. Defaults to current directory.') + parser.add_argument('-q', '--quiet', action='store_true', + help='Output only failed tests.') + + args = parser.parse_args() + + path = args.ctest_path + command = ['ctest', path, '-VV'] + + env = os.environ.copy() + env['GTEST_COLOR'] = 'no' + env['CTEST_OUTPUT_ON_FAILURE'] = '0' + env['GTEST_BRIEF'] = '0' + env['GTEST_PRINT_TIME'] = '1' + env['GTEST_PRINT_UTF8'] = '1' + + results = run(command, env) + + total = results['Total'] + total_passed = len(results['Passed']) + total_skipped = len(results['Skipped']) + total_failed = len(results['Failed']) + total_crashed = total - (total_passed + total_skipped + total_failed) + + if total > 0: + print("[CTest Parser] Preparing results...") + if args.quiet == False: + if total_passed > 0: + print_results(results['Passed'], 'Passed') + if total_skipped > 0: + print_results(results['Skipped'], 'Skipped') + if total_failed > 0: + print_results(results['Failed'], 'Failed') + + print_summary(total, total_passed, total_failed, + total_skipped, total_crashed) + if results['Success'] == False: + exit(1) + else: + print("[CTest Parser] Error: no tests were run") + + +if __name__ == '__main__': + try: + main() + except KeyboardInterrupt: + exit(130) From 062527337a6f1e1054958f4f2ac3c1ace75d7a9e Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Tue, 22 Aug 2023 19:40:35 +0000 Subject: [PATCH 002/145] [umf] extend error message for disjoint pool --- source/common/umf_pools/disjoint_pool.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/common/umf_pools/disjoint_pool.cpp b/source/common/umf_pools/disjoint_pool.cpp index 5c6c3a852a..9a4a2d79b9 100644 --- a/source/common/umf_pools/disjoint_pool.cpp +++ b/source/common/umf_pools/disjoint_pool.cpp @@ -381,6 +381,15 @@ Slab::~Slab() { } catch (MemoryProviderError &e) { std::cout << "DisjointPool: error from memory provider: " << e.code << "\n"; + if (e.code == UMF_RESULT_ERROR_MEMORY_PROVIDER_SPECIFIC) { + const char *message = ""; + int error = 0; + + umfMemoryProviderGetLastNativeError( + umfGetLastFailedMemoryProvider(), &message, &error); + std::cout << "Native error msg: " << message + << ", native error code: " << error << std::endl; + } } } From 7fd8fba468cfdbfe62f73b35f4e2558477aa5a81 Mon Sep 17 00:00:00 2001 From: Damian Duy Date: Thu, 3 Aug 2023 12:35:14 +0200 Subject: [PATCH 003/145] [umf] add out of memory test --- test/unified_malloc_framework/common/pool.hpp | 9 ++---- .../common/provider.hpp | 22 +++++++++++++ test/unified_malloc_framework/memoryPool.hpp | 32 +++++++++++++++++++ .../memoryPoolAPI.cpp | 13 ++++++-- .../umf_pools/disjoint_pool.cpp | 13 ++++++++ 5 files changed, 79 insertions(+), 10 deletions(-) diff --git a/test/unified_malloc_framework/common/pool.hpp b/test/unified_malloc_framework/common/pool.hpp index 7a7b650e11..b4a35b6822 100644 --- a/test/unified_malloc_framework/common/pool.hpp +++ b/test/unified_malloc_framework/common/pool.hpp @@ -131,9 +131,7 @@ struct proxy_pool : public pool_base { memset(ptr, 0, num * size); - if (ptr) { - EXPECT_EQ_NOEXCEPT(ret, UMF_RESULT_SUCCESS); - } + umf::getPoolLastStatusRef() = ret; return ptr; } void *realloc(void *ptr, size_t size) noexcept { @@ -145,9 +143,7 @@ struct proxy_pool : public pool_base { void *aligned_malloc(size_t size, size_t alignment) noexcept { void *ptr; auto ret = umfMemoryProviderAlloc(provider, size, alignment, &ptr); - if (ptr) { - EXPECT_EQ_NOEXCEPT(ret, UMF_RESULT_SUCCESS); - } + umf::getPoolLastStatusRef() = ret; return ptr; } size_t malloc_usable_size(void *ptr) noexcept { @@ -156,7 +152,6 @@ struct proxy_pool : public pool_base { } enum umf_result_t free(void *ptr) noexcept { auto ret = umfMemoryProviderFree(provider, ptr, 0); - EXPECT_EQ_NOEXCEPT(ret, UMF_RESULT_SUCCESS); return ret; } enum umf_result_t get_last_allocation_error() { diff --git a/test/unified_malloc_framework/common/provider.hpp b/test/unified_malloc_framework/common/provider.hpp index 518b2b0528..7aa486103c 100644 --- a/test/unified_malloc_framework/common/provider.hpp +++ b/test/unified_malloc_framework/common/provider.hpp @@ -76,6 +76,28 @@ struct provider_malloc : public provider_base { const char *get_name() noexcept { return "malloc"; } }; +struct provider_mock_out_of_mem : public provider_base { + provider_malloc helper_prov; + int allocNum = 0; + umf_result_t initialize(int allocNum) noexcept { + this->allocNum = allocNum; + return UMF_RESULT_SUCCESS; + } + enum umf_result_t alloc(size_t size, size_t align, void **ptr) noexcept { + if (allocNum <= 0) { + *ptr = nullptr; + return UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + allocNum--; + + return helper_prov.alloc(size, align, ptr); + } + enum umf_result_t free(void *ptr, size_t size) noexcept { + return helper_prov.free(ptr, size); + } + const char *get_name() noexcept { return "mock_out_of_mem"; } +}; + } // namespace umf_test #endif /* UMF_TEST_PROVIDER_HPP */ diff --git a/test/unified_malloc_framework/memoryPool.hpp b/test/unified_malloc_framework/memoryPool.hpp index fde5954cf8..963dafc062 100644 --- a/test/unified_malloc_framework/memoryPool.hpp +++ b/test/unified_malloc_framework/memoryPool.hpp @@ -3,7 +3,9 @@ // See LICENSE.TXT // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include "disjoint_pool.hpp" #include "pool.hpp" +#include "provider.hpp" #include #include @@ -53,6 +55,11 @@ struct umfMultiPoolTest : umfPoolTest { std::vector pools; }; +struct umfMemTest : umfPoolTest { + void SetUp() override { umfPoolTest::SetUp(); } + void TearDown() override { umfPoolTest::TearDown(); } +}; + TEST_P(umfPoolTest, allocFree) { static constexpr size_t allocSize = 64; auto *ptr = umfPoolMalloc(pool.get(), allocSize); @@ -251,6 +258,31 @@ TEST_P(umfPoolTest, multiThreadedMallocFreeRandomSizes) { } } +TEST_P(umfMemTest, outOfMem) { + static constexpr size_t allocSize = 16; + auto hPool = pool.get(); + + std::vector allocations; + + while (true) { + allocations.emplace_back(umfPoolMalloc(hPool, allocSize)); + if (allocations.back() == nullptr && + umfPoolGetLastAllocationError(hPool) == + UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY) { + break; + } + ASSERT_NE(allocations.back(), nullptr); + } + + // remove last nullptr from the allocations vector + ASSERT_EQ(allocations.back(), nullptr); + allocations.pop_back(); + + for (auto allocation : allocations) { + umfPoolFree(hPool, allocation); + } +} + #ifdef UMF_ENABLE_POOL_TRACKING_TESTS // TODO: add similar tests for realloc/aligned_alloc, etc. // TODO: add multithreaded tests diff --git a/test/unified_malloc_framework/memoryPoolAPI.cpp b/test/unified_malloc_framework/memoryPoolAPI.cpp index d40254fbf0..bbef6825ab 100644 --- a/test/unified_malloc_framework/memoryPoolAPI.cpp +++ b/test/unified_malloc_framework/memoryPoolAPI.cpp @@ -82,7 +82,7 @@ TEST_F(test, memoryPoolTrace) { ASSERT_EQ(providerCalls.size(), provider_call_count); ret = umfPoolGetLastAllocationError(tracingPool.get()); - ASSERT_EQ(ret, UMF_RESULT_ERROR_NOT_SUPPORTED); + ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_EQ(poolCalls["get_last_native_error"], 1); ASSERT_EQ(poolCalls.size(), ++pool_call_count); @@ -157,6 +157,15 @@ INSTANTIATE_TEST_SUITE_P( .second; })); +INSTANTIATE_TEST_SUITE_P( + proxyPoolOOMTest, umfMemTest, ::testing::Values([] { + return umf::poolMakeUnique( + {umf::memoryProviderMakeUnique< + umf_test::provider_mock_out_of_mem>(10) + .second}) + .second; + })); + ////////////////// Negative test cases ///////////////// TEST_F(test, memoryPoolInvalidProvidersNullptr) { @@ -254,10 +263,8 @@ TEST_F(test, getLastFailedMemoryProvider) { auto [ret, pool] = umf::poolMakeUnique(&hProvider, 1); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); - ASSERT_EQ(umfGetLastFailedMemoryProvider(), nullptr); auto ptr = umfPoolMalloc(pool.get(), allocSize); ASSERT_NE(ptr, nullptr); - ASSERT_EQ(umfGetLastFailedMemoryProvider(), nullptr); umfPoolFree(pool.get(), ptr); // make provider return an error during allocation diff --git a/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp b/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp index 9e4d4f7ee6..65405d9782 100644 --- a/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp +++ b/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp @@ -33,6 +33,16 @@ static auto makePool() { return std::move(pool); } +static auto makePoolOOMProvider() { + auto [ret, provider] = + umf::memoryProviderMakeUnique(10); + EXPECT_EQ(ret, UMF_RESULT_SUCCESS); + auto [retp, pool] = umf::poolMakeUnique( + {std::move(provider)}, poolConfig()); + EXPECT_EQ(retp, UMF_RESULT_SUCCESS); + return std::move(pool); +} + using umf_test::test; TEST_F(test, freeErrorPropagation) { @@ -72,6 +82,9 @@ TEST_F(test, freeErrorPropagation) { INSTANTIATE_TEST_SUITE_P(disjointPoolTests, umfPoolTest, ::testing::Values(makePool)); +INSTANTIATE_TEST_SUITE_P(disjointPoolTests, umfMemTest, + ::testing::Values(makePoolOOMProvider)); + GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfMultiPoolTest); INSTANTIATE_TEST_SUITE_P(disjointMultiPoolTests, umfMultiPoolTest, ::testing::Values(makePool)); From 17e719f70f4a69d98dca742a83198d446201d151 Mon Sep 17 00:00:00 2001 From: Callum Fare Date: Fri, 25 Aug 2023 16:50:45 +0100 Subject: [PATCH 004/145] Make urInit and urTearDown loader-only --- examples/collector/README.md | 2 +- examples/collector/collector.cpp | 33 ++-- examples/hello_world/hello_world.cpp | 7 +- include/ur.py | 148 +++++++------- include/ur_api.h | 146 +++++++------- include/ur_ddi.h | 143 +++++++------- scripts/core/CONTRIB.rst | 8 +- scripts/core/INTRO.rst | 2 +- scripts/core/{runtime.yml => adapter.yml} | 175 +---------------- scripts/core/loader.yml | 180 ++++++++++++++++++ scripts/core/registry.yml | 12 +- scripts/parse_specs.py | 1 + scripts/templates/api.h.mako | 2 + scripts/templates/api.py.mako | 2 +- scripts/templates/ldrddi.cpp.mako | 17 +- scripts/templates/libapi.cpp.mako | 22 ++- scripts/templates/libddi.cpp.mako | 2 +- scripts/templates/valddi.cpp.mako | 33 +++- source/adapters/null/ur_nullddi.cpp | 47 ----- source/common/ur_params.hpp | 77 ++++---- .../layers/tracing/ur_tracing_layer.hpp | 1 + source/loader/layers/tracing/ur_trcddi.cpp | 54 ------ source/loader/layers/ur_proxy_layer.hpp | 1 + .../layers/validation/ur_leak_check.hpp | 35 +++- source/loader/layers/validation/ur_valddi.cpp | 77 ++------ .../layers/validation/ur_validation_layer.hpp | 1 + source/loader/ur_ldrddi.cpp | 37 ---- source/loader/ur_lib.cpp | 16 +- source/loader/ur_lib.hpp | 4 +- source/loader/ur_libapi.cpp | 43 ++--- source/loader/ur_libddi.cpp | 2 +- source/ur_api.cpp | 20 +- test/conformance/CMakeLists.txt | 2 +- .../{runtime => adapter}/CMakeLists.txt | 6 +- .../{runtime => adapter}/fixtures.h | 6 +- .../{runtime => adapter}/urAdapterGet.cpp | 0 .../{runtime => adapter}/urAdapterGetInfo.cpp | 0 .../urAdapterGetLastError.cpp | 0 .../{runtime => adapter}/urAdapterRelease.cpp | 0 .../{runtime => adapter}/urAdapterRetain.cpp | 0 test/conformance/platform/fixtures.h | 5 +- test/conformance/runtime/urTearDown.cpp | 21 -- test/conformance/source/environment.cpp | 9 +- test/layers/tracing/hello_world.out.match | 30 ++- test/layers/validation/fixtures.hpp | 12 +- test/layers/validation/leaks.cpp | 6 + test/layers/validation/leaks.out.match | 17 ++ test/layers/validation/leaks_mt.out.match | 12 ++ test/layers/validation/parameters.cpp | 12 -- test/loader/CMakeLists.txt | 1 + test/loader/loader_lifetime/CMakeLists.txt | 23 +++ test/loader/loader_lifetime/fixtures.hpp | 27 +++ .../loader_lifetime/urLoaderInit.cpp} | 23 +-- .../loader_lifetime/urLoaderTearDown.cpp | 14 ++ test/loader/platforms/no_platforms.match | 2 +- test/loader/platforms/null_platform.match | 4 +- test/loader/platforms/platforms.cpp | 8 +- test/tools/urtrace/null_hello.match | 2 - test/tools/urtrace/null_hello_begin.match | 44 ++--- test/tools/urtrace/null_hello_json.match | 2 - test/tools/urtrace/null_hello_no_args.match | 2 - test/tools/urtrace/null_hello_profiling.match | 2 - test/unit/utils/params.cpp | 37 ++-- 63 files changed, 792 insertions(+), 887 deletions(-) rename scripts/core/{runtime.yml => adapter.yml} (52%) create mode 100644 scripts/core/loader.yml rename test/conformance/{runtime => adapter}/CMakeLists.txt (77%) rename test/conformance/{runtime => adapter}/fixtures.h (89%) rename test/conformance/{runtime => adapter}/urAdapterGet.cpp (100%) rename test/conformance/{runtime => adapter}/urAdapterGetInfo.cpp (100%) rename test/conformance/{runtime => adapter}/urAdapterGetLastError.cpp (100%) rename test/conformance/{runtime => adapter}/urAdapterRelease.cpp (100%) rename test/conformance/{runtime => adapter}/urAdapterRetain.cpp (100%) delete mode 100644 test/conformance/runtime/urTearDown.cpp create mode 100644 test/loader/loader_lifetime/CMakeLists.txt create mode 100644 test/loader/loader_lifetime/fixtures.hpp rename test/{conformance/runtime/urInit.cpp => loader/loader_lifetime/urLoaderInit.cpp} (67%) create mode 100644 test/loader/loader_lifetime/urLoaderTearDown.cpp diff --git a/examples/collector/README.md b/examples/collector/README.md index aaf5eed32a..fbdf18a8ae 100644 --- a/examples/collector/README.md +++ b/examples/collector/README.md @@ -19,7 +19,7 @@ $ mkdir build $ cd build $ cmake .. -DUR_ENABLE_TRACING=ON $ make -$ UR_ADAPTERS_FORCE_LOAD=./lib/libur_adapter_null.so XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=./lib/libxptifw.so XPTI_SUBSCRIBERS=./lib/libcollector.so ./bin/hello_world +$ UR_ADAPTERS_FORCE_LOAD=./lib/libur_adapter_null.so UR_ENABLE_LAYERS=UR_LAYER_TRACING XPTI_TRACE_ENABLE=1 XPTI_FRAMEWORK_DISPATCHER=./lib/libxptifw.so XPTI_SUBSCRIBERS=./lib/libcollector.so ./bin/hello_world ``` See [XPTI framework documentation](https://github.com/intel/llvm/blob/sycl/xptifw/doc/XPTI_Framework.md) for more information. diff --git a/examples/collector/collector.cpp b/examples/collector/collector.cpp index 6f2f6d57b1..ba60b083d2 100644 --- a/examples/collector/collector.cpp +++ b/examples/collector/collector.cpp @@ -34,15 +34,23 @@ constexpr uint16_t TRACE_FN_END = constexpr std::string_view UR_STREAM_NAME = "ur"; /** - * @brief Formats the function parameters and arguments for urInit + * @brief Formats the function parameters and arguments for urAdapterGet */ std::ostream &operator<<(std::ostream &os, - const struct ur_init_params_t *params) { - os << ".device_flags = "; - if (*params->pdevice_flags & UR_DEVICE_INIT_FLAG_GPU) { - os << "UR_DEVICE_INIT_FLAG_GPU"; - } else { - os << "0"; + const struct ur_adapter_get_params_t *params) { + os << ".NumEntries = "; + os << *params->pNumEntries; + os << ", "; + os << ".phAdapters = "; + os << *params->pphAdapters; + if (*params->pphAdapters) { + os << " (" << **params->pphAdapters << ")"; + } + os << ", "; + os << ".pNumAdapters = "; + os << *params->ppNumAdapters; + if (*params->ppNumAdapters) { + os << " (" << **params->ppNumAdapters << ")"; } os << ""; return os; @@ -50,16 +58,17 @@ std::ostream &operator<<(std::ostream &os, /** * A map of functions that format the parameters and arguments for each UR function. - * This example only implements a handler for one function, `urInit`, but it's + * This example only implements a handler for one function, `urAdapterGet`, but it's * trivial to expand it to support more. */ static std::unordered_map< std::string_view, std::function> - handlers = {{"urInit", [](const xpti::function_with_args_t *fn_args, - std::ostream &os) { - auto params = static_cast( - fn_args->args_data); + handlers = {{"urAdapterGet", [](const xpti::function_with_args_t *fn_args, + std::ostream &os) { + auto params = + static_cast( + fn_args->args_data); os << params; }}}; diff --git a/examples/hello_world/hello_world.cpp b/examples/hello_world/hello_world.cpp index 4d903da65a..11e5374390 100644 --- a/examples/hello_world/hello_world.cpp +++ b/examples/hello_world/hello_world.cpp @@ -19,9 +19,10 @@ int main(int argc, char *argv[]) { ur_result_t status; // Initialize the platform - status = urInit(0, nullptr); + status = urLoaderInit(0, nullptr); if (status != UR_RESULT_SUCCESS) { - std::cout << "urInit failed with return code: " << status << std::endl; + std::cout << "urLoaderInit failed with return code: " << status + << std::endl; return 1; } std::cout << "Platform initialized.\n"; @@ -119,6 +120,6 @@ int main(int argc, char *argv[]) { for (auto adapter : adapters) { urAdapterRelease(adapter); } - urTearDown(nullptr); + urLoaderTearDown(); return status == UR_RESULT_SUCCESS ? 0 : 1; } diff --git a/include/ur.py b/include/ur.py index f606ce4127..2f47142381 100644 --- a/include/ur.py +++ b/include/ur.py @@ -117,8 +117,6 @@ class ur_function_v(IntEnum): QUEUE_CREATE_WITH_NATIVE_HANDLE = 96 ## Enumerator for ::urQueueCreateWithNativeHandle QUEUE_FINISH = 97 ## Enumerator for ::urQueueFinish QUEUE_FLUSH = 98 ## Enumerator for ::urQueueFlush - INIT = 99 ## Enumerator for ::urInit - TEAR_DOWN = 100 ## Enumerator for ::urTearDown SAMPLER_CREATE = 101 ## Enumerator for ::urSamplerCreate SAMPLER_RETAIN = 102 ## Enumerator for ::urSamplerRetain SAMPLER_RELEASE = 103 ## Enumerator for ::urSamplerRelease @@ -196,6 +194,8 @@ class ur_function_v(IntEnum): ADAPTER_RETAIN = 179 ## Enumerator for ::urAdapterRetain ADAPTER_GET_LAST_ERROR = 180 ## Enumerator for ::urAdapterGetLastError ADAPTER_GET_INFO = 181 ## Enumerator for ::urAdapterGetInfo + LOADER_INIT = 182 ## Enumerator for ::urLoaderInit + LOADER_TEAR_DOWN = 183 ## Enumerator for ::urLoaderTearDown class ur_function_t(c_int): def __str__(self): @@ -2870,6 +2870,53 @@ class ur_physical_mem_dditable_t(Structure): ("pfnRelease", c_void_p) ## _urPhysicalMemRelease_t ] +############################################################################### +## @brief Function-pointer for urAdapterGet +if __use_win_types: + _urAdapterGet_t = WINFUNCTYPE( ur_result_t, c_ulong, POINTER(ur_adapter_handle_t), POINTER(c_ulong) ) +else: + _urAdapterGet_t = CFUNCTYPE( ur_result_t, c_ulong, POINTER(ur_adapter_handle_t), POINTER(c_ulong) ) + +############################################################################### +## @brief Function-pointer for urAdapterRelease +if __use_win_types: + _urAdapterRelease_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t ) +else: + _urAdapterRelease_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t ) + +############################################################################### +## @brief Function-pointer for urAdapterRetain +if __use_win_types: + _urAdapterRetain_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t ) +else: + _urAdapterRetain_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t ) + +############################################################################### +## @brief Function-pointer for urAdapterGetLastError +if __use_win_types: + _urAdapterGetLastError_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t, POINTER(c_char_p), POINTER(c_long) ) +else: + _urAdapterGetLastError_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t, POINTER(c_char_p), POINTER(c_long) ) + +############################################################################### +## @brief Function-pointer for urAdapterGetInfo +if __use_win_types: + _urAdapterGetInfo_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t, ur_adapter_info_t, c_size_t, c_void_p, POINTER(c_size_t) ) +else: + _urAdapterGetInfo_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t, ur_adapter_info_t, c_size_t, c_void_p, POINTER(c_size_t) ) + + +############################################################################### +## @brief Table of Global functions pointers +class ur_global_dditable_t(Structure): + _fields_ = [ + ("pfnAdapterGet", c_void_p), ## _urAdapterGet_t + ("pfnAdapterRelease", c_void_p), ## _urAdapterRelease_t + ("pfnAdapterRetain", c_void_p), ## _urAdapterRetain_t + ("pfnAdapterGetLastError", c_void_p), ## _urAdapterGetLastError_t + ("pfnAdapterGetInfo", c_void_p) ## _urAdapterGetInfo_t + ] + ############################################################################### ## @brief Function-pointer for urEnqueueKernelLaunch if __use_win_types: @@ -3543,69 +3590,6 @@ class ur_usm_p2p_exp_dditable_t(Structure): ("pfnPeerAccessGetInfoExp", c_void_p) ## _urUsmP2PPeerAccessGetInfoExp_t ] -############################################################################### -## @brief Function-pointer for urInit -if __use_win_types: - _urInit_t = WINFUNCTYPE( ur_result_t, ur_device_init_flags_t, ur_loader_config_handle_t ) -else: - _urInit_t = CFUNCTYPE( ur_result_t, ur_device_init_flags_t, ur_loader_config_handle_t ) - -############################################################################### -## @brief Function-pointer for urTearDown -if __use_win_types: - _urTearDown_t = WINFUNCTYPE( ur_result_t, c_void_p ) -else: - _urTearDown_t = CFUNCTYPE( ur_result_t, c_void_p ) - -############################################################################### -## @brief Function-pointer for urAdapterGet -if __use_win_types: - _urAdapterGet_t = WINFUNCTYPE( ur_result_t, c_ulong, POINTER(ur_adapter_handle_t), POINTER(c_ulong) ) -else: - _urAdapterGet_t = CFUNCTYPE( ur_result_t, c_ulong, POINTER(ur_adapter_handle_t), POINTER(c_ulong) ) - -############################################################################### -## @brief Function-pointer for urAdapterRelease -if __use_win_types: - _urAdapterRelease_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t ) -else: - _urAdapterRelease_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t ) - -############################################################################### -## @brief Function-pointer for urAdapterRetain -if __use_win_types: - _urAdapterRetain_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t ) -else: - _urAdapterRetain_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t ) - -############################################################################### -## @brief Function-pointer for urAdapterGetLastError -if __use_win_types: - _urAdapterGetLastError_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t, POINTER(c_char_p), POINTER(c_long) ) -else: - _urAdapterGetLastError_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t, POINTER(c_char_p), POINTER(c_long) ) - -############################################################################### -## @brief Function-pointer for urAdapterGetInfo -if __use_win_types: - _urAdapterGetInfo_t = WINFUNCTYPE( ur_result_t, ur_adapter_handle_t, ur_adapter_info_t, c_size_t, c_void_p, POINTER(c_size_t) ) -else: - _urAdapterGetInfo_t = CFUNCTYPE( ur_result_t, ur_adapter_handle_t, ur_adapter_info_t, c_size_t, c_void_p, POINTER(c_size_t) ) - - -############################################################################### -## @brief Table of Global functions pointers -class ur_global_dditable_t(Structure): - _fields_ = [ - ("pfnInit", c_void_p), ## _urInit_t - ("pfnTearDown", c_void_p), ## _urTearDown_t - ("pfnAdapterGet", c_void_p), ## _urAdapterGet_t - ("pfnAdapterRelease", c_void_p), ## _urAdapterRelease_t - ("pfnAdapterRetain", c_void_p), ## _urAdapterRetain_t - ("pfnAdapterGetLastError", c_void_p), ## _urAdapterGetLastError_t - ("pfnAdapterGetInfo", c_void_p) ## _urAdapterGetInfo_t - ] - ############################################################################### ## @brief Function-pointer for urVirtualMemGranularityGetInfo if __use_win_types: @@ -3759,6 +3743,7 @@ class ur_dditable_t(Structure): ("Sampler", ur_sampler_dditable_t), ("Mem", ur_mem_dditable_t), ("PhysicalMem", ur_physical_mem_dditable_t), + ("Global", ur_global_dditable_t), ("Enqueue", ur_enqueue_dditable_t), ("Queue", ur_queue_dditable_t), ("BindlessImagesExp", ur_bindless_images_exp_dditable_t), @@ -3766,7 +3751,6 @@ class ur_dditable_t(Structure): ("USMExp", ur_usm_exp_dditable_t), ("CommandBufferExp", ur_command_buffer_exp_dditable_t), ("UsmP2PExp", ur_usm_p2p_exp_dditable_t), - ("Global", ur_global_dditable_t), ("VirtualMem", ur_virtual_mem_dditable_t), ("Device", ur_device_dditable_t) ] @@ -3785,7 +3769,7 @@ def __init__(self, version : ur_api_version_t): self.__dditable = ur_dditable_t() # initialize the UR - self.__dll.urInit(0, 0) + self.__dll.urLoaderInit(0, 0) # call driver to get function pointers Platform = ur_platform_dditable_t() @@ -3927,6 +3911,20 @@ def __init__(self, version : ur_api_version_t): self.urPhysicalMemRetain = _urPhysicalMemRetain_t(self.__dditable.PhysicalMem.pfnRetain) self.urPhysicalMemRelease = _urPhysicalMemRelease_t(self.__dditable.PhysicalMem.pfnRelease) + # call driver to get function pointers + Global = ur_global_dditable_t() + r = ur_result_v(self.__dll.urGetGlobalProcAddrTable(version, byref(Global))) + if r != ur_result_v.SUCCESS: + raise Exception(r) + self.__dditable.Global = Global + + # attach function interface to function address + self.urAdapterGet = _urAdapterGet_t(self.__dditable.Global.pfnAdapterGet) + self.urAdapterRelease = _urAdapterRelease_t(self.__dditable.Global.pfnAdapterRelease) + self.urAdapterRetain = _urAdapterRetain_t(self.__dditable.Global.pfnAdapterRetain) + self.urAdapterGetLastError = _urAdapterGetLastError_t(self.__dditable.Global.pfnAdapterGetLastError) + self.urAdapterGetInfo = _urAdapterGetInfo_t(self.__dditable.Global.pfnAdapterGetInfo) + # call driver to get function pointers Enqueue = ur_enqueue_dditable_t() r = ur_result_v(self.__dll.urGetEnqueueProcAddrTable(version, byref(Enqueue))) @@ -4068,22 +4066,6 @@ def __init__(self, version : ur_api_version_t): self.urUsmP2PDisablePeerAccessExp = _urUsmP2PDisablePeerAccessExp_t(self.__dditable.UsmP2PExp.pfnDisablePeerAccessExp) self.urUsmP2PPeerAccessGetInfoExp = _urUsmP2PPeerAccessGetInfoExp_t(self.__dditable.UsmP2PExp.pfnPeerAccessGetInfoExp) - # call driver to get function pointers - Global = ur_global_dditable_t() - r = ur_result_v(self.__dll.urGetGlobalProcAddrTable(version, byref(Global))) - if r != ur_result_v.SUCCESS: - raise Exception(r) - self.__dditable.Global = Global - - # attach function interface to function address - self.urInit = _urInit_t(self.__dditable.Global.pfnInit) - self.urTearDown = _urTearDown_t(self.__dditable.Global.pfnTearDown) - self.urAdapterGet = _urAdapterGet_t(self.__dditable.Global.pfnAdapterGet) - self.urAdapterRelease = _urAdapterRelease_t(self.__dditable.Global.pfnAdapterRelease) - self.urAdapterRetain = _urAdapterRetain_t(self.__dditable.Global.pfnAdapterRetain) - self.urAdapterGetLastError = _urAdapterGetLastError_t(self.__dditable.Global.pfnAdapterGetLastError) - self.urAdapterGetInfo = _urAdapterGetInfo_t(self.__dditable.Global.pfnAdapterGetInfo) - # call driver to get function pointers VirtualMem = ur_virtual_mem_dditable_t() r = ur_result_v(self.__dll.urGetVirtualMemProcAddrTable(version, byref(VirtualMem))) diff --git a/include/ur_api.h b/include/ur_api.h index c9f29a1535..30696c2932 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -126,8 +126,6 @@ typedef enum ur_function_t { UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE = 96, ///< Enumerator for ::urQueueCreateWithNativeHandle UR_FUNCTION_QUEUE_FINISH = 97, ///< Enumerator for ::urQueueFinish UR_FUNCTION_QUEUE_FLUSH = 98, ///< Enumerator for ::urQueueFlush - UR_FUNCTION_INIT = 99, ///< Enumerator for ::urInit - UR_FUNCTION_TEAR_DOWN = 100, ///< Enumerator for ::urTearDown UR_FUNCTION_SAMPLER_CREATE = 101, ///< Enumerator for ::urSamplerCreate UR_FUNCTION_SAMPLER_RETAIN = 102, ///< Enumerator for ::urSamplerRetain UR_FUNCTION_SAMPLER_RELEASE = 103, ///< Enumerator for ::urSamplerRelease @@ -205,6 +203,8 @@ typedef enum ur_function_t { UR_FUNCTION_ADAPTER_RETAIN = 179, ///< Enumerator for ::urAdapterRetain UR_FUNCTION_ADAPTER_GET_LAST_ERROR = 180, ///< Enumerator for ::urAdapterGetLastError UR_FUNCTION_ADAPTER_GET_INFO = 181, ///< Enumerator for ::urAdapterGetInfo + UR_FUNCTION_LOADER_INIT = 182, ///< Enumerator for ::urLoaderInit + UR_FUNCTION_LOADER_TEAR_DOWN = 183, ///< Enumerator for ::urLoaderTearDown /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -515,9 +515,9 @@ typedef struct ur_rect_region_t { #if !defined(__GNUC__) #pragma endregion #endif -// Intel 'oneAPI' Unified Runtime APIs for Runtime +// Intel 'oneAPI' Unified Runtime APIs for Loader #if !defined(__GNUC__) -#pragma region runtime +#pragma region loader #endif /////////////////////////////////////////////////////////////////////////////// /// @brief Supported device initialization flags @@ -668,21 +668,21 @@ urLoaderConfigEnableLayer( ); /////////////////////////////////////////////////////////////////////////////// -/// @brief Initialize the 'oneAPI' adapter(s) +/// @brief Initialize the 'oneAPI' loader /// /// @details /// - The application must call this function before calling any other /// function. /// - If this function is not called then all other functions will return /// ::UR_RESULT_ERROR_UNINITIALIZED. -/// - Only one instance of each adapter will be initialized per process. +/// - Only one instance of the loader will be initialized per process. /// - The application may call this function multiple times with different /// flags or environment variables enabled. /// - The application must call this function after forking new processes. /// Each forked process must call this function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe for scenarios -/// where multiple libraries may initialize the adapter(s) simultaneously. +/// where multiple libraries may initialize the loader simultaneously. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -693,28 +693,32 @@ urLoaderConfigEnableLayer( /// + `::UR_DEVICE_INIT_FLAGS_MASK & device_flags` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY UR_APIEXPORT ur_result_t UR_APICALL -urInit( +urLoaderInit( ur_device_init_flags_t device_flags, ///< [in] device initialization flags. ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. ur_loader_config_handle_t hLoaderConfig ///< [in][optional] Handle of loader config handle. ); /////////////////////////////////////////////////////////////////////////////// -/// @brief Tear down the 'oneAPI' instance and release all its resources +/// @brief Tear down the 'oneAPI' loader and release all its resources /// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == pParams` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY UR_APIEXPORT ur_result_t UR_APICALL -urTearDown( - void *pParams ///< [in] pointer to tear down parameters -); +urLoaderTearDown( + void); +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime APIs for Adapter +#if !defined(__GNUC__) +#pragma region adapter +#endif /////////////////////////////////////////////////////////////////////////////// /// @brief Retrieves all available adapters /// @@ -753,7 +757,9 @@ urAdapterGet( /// /// @details /// - When the reference count of the adapter reaches zero, the adapter may -/// perform adapter-specififc resource teardown +/// perform adapter-specififc resource teardown. Resources must be left in +/// a state where it safe for the adapter to be subsequently reinitialized +/// with ::urAdapterGet /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -8995,6 +9001,54 @@ typedef struct ur_physical_mem_release_params_t { ur_physical_mem_handle_t *phPhysicalMem; } ur_physical_mem_release_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGet +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_params_t { + uint32_t *pNumEntries; + ur_adapter_handle_t **pphAdapters; + uint32_t **ppNumAdapters; +} ur_adapter_get_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterRelease +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_release_params_t { + ur_adapter_handle_t *phAdapter; +} ur_adapter_release_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterRetain +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_retain_params_t { + ur_adapter_handle_t *phAdapter; +} ur_adapter_retain_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGetLastError +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_last_error_params_t { + ur_adapter_handle_t *phAdapter; + const char ***pppMessage; + int32_t **ppError; +} ur_adapter_get_last_error_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urAdapterGetInfo +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_adapter_get_info_params_t { + ur_adapter_handle_t *phAdapter; + ur_adapter_info_t *ppropName; + size_t *ppropSize; + void **ppPropValue; + size_t **ppPropSizeRet; +} ur_adapter_get_info_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urEnqueueKernelLaunch /// @details Each entry is a pointer to the parameter passed to the function; @@ -10027,69 +10081,13 @@ typedef struct ur_usm_p2p_peer_access_get_info_exp_params_t { } ur_usm_p2p_peer_access_get_info_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urInit +/// @brief Function parameters for urLoaderInit /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_init_params_t { +typedef struct ur_loader_init_params_t { ur_device_init_flags_t *pdevice_flags; ur_loader_config_handle_t *phLoaderConfig; -} ur_init_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urTearDown -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_tear_down_params_t { - void **ppParams; -} ur_tear_down_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterGet -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_get_params_t { - uint32_t *pNumEntries; - ur_adapter_handle_t **pphAdapters; - uint32_t **ppNumAdapters; -} ur_adapter_get_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterRelease -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_release_params_t { - ur_adapter_handle_t *phAdapter; -} ur_adapter_release_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterRetain -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_retain_params_t { - ur_adapter_handle_t *phAdapter; -} ur_adapter_retain_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterGetLastError -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_get_last_error_params_t { - ur_adapter_handle_t *phAdapter; - const char ***pppMessage; - int32_t **ppError; -} ur_adapter_get_last_error_params_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urAdapterGetInfo -/// @details Each entry is a pointer to the parameter passed to the function; -/// allowing the callback the ability to modify the parameter's value -typedef struct ur_adapter_get_info_params_t { - ur_adapter_handle_t *phAdapter; - ur_adapter_info_t *ppropName; - size_t *ppropSize; - void **ppPropValue; - size_t **ppPropSizeRet; -} ur_adapter_get_info_params_t; +} ur_loader_init_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urVirtualMemGranularityGetInfo diff --git a/include/ur_ddi.h b/include/ur_ddi.h index a61cbee653..cd6e9f77d9 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -803,6 +803,70 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetPhysicalMemProcAddrTable_t)( ur_api_version_t, ur_physical_mem_dditable_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterGet +typedef ur_result_t(UR_APICALL *ur_pfnAdapterGet_t)( + uint32_t, + ur_adapter_handle_t *, + uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterRelease +typedef ur_result_t(UR_APICALL *ur_pfnAdapterRelease_t)( + ur_adapter_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterRetain +typedef ur_result_t(UR_APICALL *ur_pfnAdapterRetain_t)( + ur_adapter_handle_t); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterGetLastError +typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetLastError_t)( + ur_adapter_handle_t, + const char **, + int32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urAdapterGetInfo +typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetInfo_t)( + ur_adapter_handle_t, + ur_adapter_info_t, + size_t, + void *, + size_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of Global functions pointers +typedef struct ur_global_dditable_t { + ur_pfnAdapterGet_t pfnAdapterGet; + ur_pfnAdapterRelease_t pfnAdapterRelease; + ur_pfnAdapterRetain_t pfnAdapterRetain; + ur_pfnAdapterGetLastError_t pfnAdapterGetLastError; + ur_pfnAdapterGetInfo_t pfnAdapterGetInfo; +} ur_global_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's Global table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL +urGetGlobalProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_global_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetGlobalProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetGlobalProcAddrTable_t)( + ur_api_version_t, + ur_global_dditable_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urEnqueueKernelLaunch typedef ur_result_t(UR_APICALL *ur_pfnEnqueueKernelLaunch_t)( @@ -1860,83 +1924,6 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetUsmP2PExpProcAddrTable_t)( ur_api_version_t, ur_usm_p2p_exp_dditable_t *); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urInit -typedef ur_result_t(UR_APICALL *ur_pfnInit_t)( - ur_device_init_flags_t, - ur_loader_config_handle_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urTearDown -typedef ur_result_t(UR_APICALL *ur_pfnTearDown_t)( - void *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urAdapterGet -typedef ur_result_t(UR_APICALL *ur_pfnAdapterGet_t)( - uint32_t, - ur_adapter_handle_t *, - uint32_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urAdapterRelease -typedef ur_result_t(UR_APICALL *ur_pfnAdapterRelease_t)( - ur_adapter_handle_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urAdapterRetain -typedef ur_result_t(UR_APICALL *ur_pfnAdapterRetain_t)( - ur_adapter_handle_t); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urAdapterGetLastError -typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetLastError_t)( - ur_adapter_handle_t, - const char **, - int32_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urAdapterGetInfo -typedef ur_result_t(UR_APICALL *ur_pfnAdapterGetInfo_t)( - ur_adapter_handle_t, - ur_adapter_info_t, - size_t, - void *, - size_t *); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Table of Global functions pointers -typedef struct ur_global_dditable_t { - ur_pfnInit_t pfnInit; - ur_pfnTearDown_t pfnTearDown; - ur_pfnAdapterGet_t pfnAdapterGet; - ur_pfnAdapterRelease_t pfnAdapterRelease; - ur_pfnAdapterRetain_t pfnAdapterRetain; - ur_pfnAdapterGetLastError_t pfnAdapterGetLastError; - ur_pfnAdapterGetInfo_t pfnAdapterGetInfo; -} ur_global_dditable_t; - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Exported function for filling application's Global table -/// with current process' addresses -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION -UR_DLLEXPORT ur_result_t UR_APICALL -urGetGlobalProcAddrTable( - ur_api_version_t version, ///< [in] API version requested - ur_global_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers -); - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urGetGlobalProcAddrTable -typedef ur_result_t(UR_APICALL *ur_pfnGetGlobalProcAddrTable_t)( - ur_api_version_t, - ur_global_dditable_t *); - /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urVirtualMemGranularityGetInfo typedef ur_result_t(UR_APICALL *ur_pfnVirtualMemGranularityGetInfo_t)( @@ -2143,6 +2130,7 @@ typedef struct ur_dditable_t { ur_sampler_dditable_t Sampler; ur_mem_dditable_t Mem; ur_physical_mem_dditable_t PhysicalMem; + ur_global_dditable_t Global; ur_enqueue_dditable_t Enqueue; ur_queue_dditable_t Queue; ur_bindless_images_exp_dditable_t BindlessImagesExp; @@ -2150,7 +2138,6 @@ typedef struct ur_dditable_t { ur_usm_exp_dditable_t USMExp; ur_command_buffer_exp_dditable_t CommandBufferExp; ur_usm_p2p_exp_dditable_t UsmP2PExp; - ur_global_dditable_t Global; ur_virtual_mem_dditable_t VirtualMem; ur_device_dditable_t Device; } ur_dditable_t; diff --git a/scripts/core/CONTRIB.rst b/scripts/core/CONTRIB.rst index f40307e34e..137f190b31 100644 --- a/scripts/core/CONTRIB.rst +++ b/scripts/core/CONTRIB.rst @@ -137,8 +137,8 @@ defined within them, with the following exceptions: enumerations, and structure type enumerations. * `scripts/core/enqueue.yml`_ defines commands which can be enqueued on a queue object. -* `scripts/core/runtime.yml`_ defines global symbols pertaining to - initialization and tear down of the entire runtime. +* `scripts/core/loader.yml`_ defines global symbols pertaining to + initialization and tear down of the loader. * `scripts/core/registry.yml`_ contains an enumeration of all entry-points, past and present, for use in the XPTI tracing framework. It is automatically updated so shouldn't require manual editing. @@ -148,8 +148,8 @@ defined within them, with the following exceptions: https://github.com/oneapi-src/unified-runtime/blob/main/scripts/core/common.yml .. _scripts/core/enqueue.yml: https://github.com/oneapi-src/unified-runtime/blob/main/scripts/core/enqueue.yml -.. _scripts/core/runtime.yml: - https://github.com/oneapi-src/unified-runtime/blob/main/scripts/core/runtime.yml +.. _scripts/core/loader.yml: + https://github.com/oneapi-src/unified-runtime/blob/main/scripts/core/loader.yml .. _scripts/core/registry.yml: https://github.com/oneapi-src/unified-runtime/blob/main/scripts/core/registry.yml diff --git a/scripts/core/INTRO.rst b/scripts/core/INTRO.rst index 8b9938cfb2..d3a862ad87 100644 --- a/scripts/core/INTRO.rst +++ b/scripts/core/INTRO.rst @@ -307,7 +307,7 @@ Specific environment variables can be set to control the behavior of unified run .. envvar:: UR_ENABLE_LAYERS - Holds a comma-separated list of layers to enable in addition to any specified via ``urInit``. + Holds a comma-separated list of layers to enable in addition to any specified via ``urLoaderInit``. .. note:: diff --git a/scripts/core/runtime.yml b/scripts/core/adapter.yml similarity index 52% rename from scripts/core/runtime.yml rename to scripts/core/adapter.yml index c14f939cc2..a2331244e1 100644 --- a/scripts/core/runtime.yml +++ b/scripts/core/adapter.yml @@ -1,5 +1,5 @@ # -# Copyright (C) 2022 Intel Corporation +# Copyright (C) 2022-2023 Intel Corporation # # Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. # See LICENSE.TXT @@ -9,176 +9,8 @@ # --- #-------------------------------------------------------------------------- type: header -desc: "Intel $OneApi Unified Runtime APIs for Runtime" -ordinal: "0" ---- #-------------------------------------------------------------------------- -type: enum -desc: "Supported device initialization flags" -class: $x -name: $x_device_init_flags_t -etors: - - name: GPU - desc: "initialize GPU device adapters." - - name: CPU - desc: "initialize CPU device adapters." - - name: FPGA - desc: "initialize FPGA device adapters." - - name: MCA - desc: "initialize MCA device adapters." - - name: VPU - desc: "initialize VPU device adapters." ---- #-------------------------------------------------------------------------- -type: function -desc: "Create a loader config object." -class: $xLoaderConfig -loader_only: True -name: Create -decl: static -params: - - type: $x_loader_config_handle_t* - name: phLoaderConfig - desc: "[out] Pointer to handle of loader config object created." ---- #-------------------------------------------------------------------------- -type: function -desc: "Get a reference to the loader config object." -class: $xLoaderConfig -loader_only: True -name: Retain -decl: static -details: - - "Get a reference to the loader config handle. Increment its reference count" - - "The application may call this function from simultaneous threads." - - "The implementation of this function should be lock-free." -params: - - type: $x_loader_config_handle_t - name: hLoaderConfig - desc: "[in] loader config handle to retain" ---- #-------------------------------------------------------------------------- -type: function -desc: "Release config handle." -class: $xLoaderConfig -loader_only: True -name: Release -decl: static -details: - - "Decrement reference count and destroy the config handle if reference count becomes zero." - - "The application may call this function from simultaneous threads." - - "The implementation of this function should be lock-free." -params: - - type: $x_loader_config_handle_t - name: hLoaderConfig - desc: "[in] config handle to release" ---- #-------------------------------------------------------------------------- -type: enum -desc: "Supported loader info" -class: $xLoaderConfig -name: $x_loader_config_info_t -typed_etors: True -etors: - - name: AVAILABLE_LAYERS - desc: "[char[]] Null-terminated, semi-colon separated list of available layers." - - name: REFERENCE_COUNT - desc: "[uint32_t] Reference count of the loader config object." ---- #-------------------------------------------------------------------------- -type: function -desc: "Retrieves various information about the loader." -class: $xLoaderConfig -loader_only: True -name: GetInfo -decl: static -details: - - "The application may call this function from simultaneous threads." - - "The implementation of this function should be lock-free." -params: - - type: $x_loader_config_handle_t - name: hLoaderConfig - desc: "[in] handle of the loader config object" - - type: $x_loader_config_info_t - name: propName - desc: "[in] type of the info to retrieve" - - type: "size_t" - name: propSize - desc: | - [in] the number of bytes pointed to by pPropValue. - - type: "void*" - name: pPropValue - desc: | - [out][optional][typename(propName, propSize)] array of bytes holding the info. - If propSize is not equal to or greater than the real number of bytes needed to return the info - then the $X_RESULT_ERROR_INVALID_SIZE error is returned and pPropValue is not used. - - type: "size_t*" - name: pPropSizeRet - desc: | - [out][optional] pointer to the actual size in bytes of the queried propName. -returns: - - $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION: - - "If `propName` is not supported by the loader." - - $X_RESULT_ERROR_INVALID_SIZE: - - "`propSize == 0 && pPropValue != NULL`" - - "If `propSize` is less than the real number of bytes needed to return the info." - - $X_RESULT_ERROR_INVALID_NULL_POINTER: - - "`propSize != 0 && pPropValue == NULL`" - - "`pPropValue == NULL && pPropSizeRet == NULL`" - - $X_RESULT_ERROR_INVALID_DEVICE - - $X_RESULT_ERROR_OUT_OF_RESOURCES - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY ---- #-------------------------------------------------------------------------- -type: function -desc: "Enable a layer for the specified loader config." -class: $xLoaderConfig -loader_only: True -name: EnableLayer -decl: static -params: - - type: $x_loader_config_handle_t - name: hLoaderConfig - desc: "[in] Handle to config object the layer will be enabled for." - - type: const char* - name: pLayerName - desc: "[in] Null terminated string containing the name of the layer to enable." -returns: - - $X_RESULT_ERROR_LAYER_NOT_PRESENT: - - "If layer specified with `pLayerName` can't be found by the loader." ---- #-------------------------------------------------------------------------- -type: function -desc: "Initialize the $OneApi adapter(s)" -class: $x -name: Init -decl: static -ordinal: "0" -details: - - "The application must call this function before calling any other function." - - "If this function is not called then all other functions will return $X_RESULT_ERROR_UNINITIALIZED." - - "Only one instance of each adapter 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 adapter(s) simultaneously." -params: - - type: $x_device_init_flags_t - name: device_flags - desc: | - [in] device initialization flags. - must be 0 (default) or a combination of $x_device_init_flag_t. - init: "0" - - type: $x_loader_config_handle_t - name: hLoaderConfig - desc: "[in][optional] Handle of loader config handle." -returns: - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY ---- #-------------------------------------------------------------------------- -type: function -desc: "Tear down the $OneApi instance and release all its resources" -class: $x -name: TearDown -decl: static +desc: "Intel $OneApi Unified Runtime APIs for Adapter" ordinal: "1" -params: - - type: void* - name: pParams - desc: "[in] pointer to tear down parameters" -returns: - - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY --- #-------------------------------------------------------------------------- type: function desc: "Retrieves all available adapters" @@ -218,7 +50,8 @@ name: AdapterRelease decl: static ordinal: "3" details: - - "When the reference count of the adapter reaches zero, the adapter may perform adapter-specififc resource teardown" + - "When the reference count of the adapter reaches zero, the adapter may perform adapter-specififc resource teardown. Resources + must be left in a state where it safe for the adapter to be subsequently reinitialized with $xAdapterGet" params: - type: "$x_adapter_handle_t" name: hAdapter diff --git a/scripts/core/loader.yml b/scripts/core/loader.yml new file mode 100644 index 0000000000..c0311bd31a --- /dev/null +++ b/scripts/core/loader.yml @@ -0,0 +1,180 @@ +# +# Copyright (C) 2022-2023 Intel Corporation +# +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# See YaML.md for syntax definition +# +--- #-------------------------------------------------------------------------- +type: header +desc: "Intel $OneApi Unified Runtime APIs for Loader" +ordinal: "0" +--- #-------------------------------------------------------------------------- +type: enum +desc: "Supported device initialization flags" +class: $x +name: $x_device_init_flags_t +etors: + - name: GPU + desc: "initialize GPU device adapters." + - name: CPU + desc: "initialize CPU device adapters." + - name: FPGA + desc: "initialize FPGA device adapters." + - name: MCA + desc: "initialize MCA device adapters." + - name: VPU + desc: "initialize VPU device adapters." +--- #-------------------------------------------------------------------------- +type: function +desc: "Create a loader config object." +class: $xLoaderConfig +loader_only: True +name: Create +decl: static +params: + - type: $x_loader_config_handle_t* + name: phLoaderConfig + desc: "[out] Pointer to handle of loader config object created." +--- #-------------------------------------------------------------------------- +type: function +desc: "Get a reference to the loader config object." +class: $xLoaderConfig +loader_only: True +name: Retain +decl: static +details: + - "Get a reference to the loader config handle. Increment its reference count" + - "The application may call this function from simultaneous threads." + - "The implementation of this function should be lock-free." +params: + - type: $x_loader_config_handle_t + name: hLoaderConfig + desc: "[in] loader config handle to retain" +--- #-------------------------------------------------------------------------- +type: function +desc: "Release config handle." +class: $xLoaderConfig +loader_only: True +name: Release +decl: static +details: + - "Decrement reference count and destroy the config handle if reference count becomes zero." + - "The application may call this function from simultaneous threads." + - "The implementation of this function should be lock-free." +params: + - type: $x_loader_config_handle_t + name: hLoaderConfig + desc: "[in] config handle to release" +--- #-------------------------------------------------------------------------- +type: enum +desc: "Supported loader info" +class: $xLoaderConfig +name: $x_loader_config_info_t +typed_etors: True +etors: + - name: AVAILABLE_LAYERS + desc: "[char[]] Null-terminated, semi-colon separated list of available layers." + - name: REFERENCE_COUNT + desc: "[uint32_t] Reference count of the loader config object." +--- #-------------------------------------------------------------------------- +type: function +desc: "Retrieves various information about the loader." +class: $xLoaderConfig +loader_only: True +name: GetInfo +decl: static +details: + - "The application may call this function from simultaneous threads." + - "The implementation of this function should be lock-free." +params: + - type: $x_loader_config_handle_t + name: hLoaderConfig + desc: "[in] handle of the loader config object" + - type: $x_loader_config_info_t + name: propName + desc: "[in] type of the info to retrieve" + - type: "size_t" + name: propSize + desc: | + [in] the number of bytes pointed to by pPropValue. + - type: "void*" + name: pPropValue + desc: | + [out][optional][typename(propName, propSize)] array of bytes holding the info. + If propSize is not equal to or greater than the real number of bytes needed to return the info + then the $X_RESULT_ERROR_INVALID_SIZE error is returned and pPropValue is not used. + - type: "size_t*" + name: pPropSizeRet + desc: | + [out][optional] pointer to the actual size in bytes of the queried propName. +returns: + - $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION: + - "If `propName` is not supported by the loader." + - $X_RESULT_ERROR_INVALID_SIZE: + - "`propSize == 0 && pPropValue != NULL`" + - "If `propSize` is less than the real number of bytes needed to return the info." + - $X_RESULT_ERROR_INVALID_NULL_POINTER: + - "`propSize != 0 && pPropValue == NULL`" + - "`pPropValue == NULL && pPropSizeRet == NULL`" + - $X_RESULT_ERROR_INVALID_DEVICE + - $X_RESULT_ERROR_OUT_OF_RESOURCES + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY +--- #-------------------------------------------------------------------------- +type: function +desc: "Enable a layer for the specified loader config." +class: $xLoaderConfig +loader_only: True +name: EnableLayer +decl: static +params: + - type: $x_loader_config_handle_t + name: hLoaderConfig + desc: "[in] Handle to config object the layer will be enabled for." + - type: const char* + name: pLayerName + desc: "[in] Null terminated string containing the name of the layer to enable." +returns: + - $X_RESULT_ERROR_LAYER_NOT_PRESENT: + - "If layer specified with `pLayerName` can't be found by the loader." +--- #-------------------------------------------------------------------------- +type: function +desc: "Initialize the $OneApi loader" +class: $xLoader +loader_only: True +name: Init +decl: static +ordinal: "0" +details: + - "The application must call this function before calling any other function." + - "If this function is not called then all other functions will return $X_RESULT_ERROR_UNINITIALIZED." + - "Only one instance of the loader will be initialized per process." + - "The application may call this function multiple times with different flags or environment variables enabled." + - "The application must call this function after forking new processes. Each forked process must call this function." + - "The application may call this function from simultaneous threads." + - "The implementation of this function must be thread-safe for scenarios where multiple libraries may initialize the loader simultaneously." +params: + - type: $x_device_init_flags_t + name: device_flags + desc: | + [in] device initialization flags. + must be 0 (default) or a combination of $x_device_init_flag_t. + init: "0" + - type: $x_loader_config_handle_t + name: hLoaderConfig + desc: "[in][optional] Handle of loader config handle." +returns: + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY +--- #-------------------------------------------------------------------------- +type: function +desc: "Tear down the $OneApi loader and release all its resources" +class: $xLoader +loader_only: True +name: TearDown +decl: static +ordinal: "1" +params: [] +returns: + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 30596ec14e..435e7d8eda 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -292,12 +292,6 @@ etors: - name: QUEUE_FLUSH desc: Enumerator for $xQueueFlush value: '98' -- name: INIT - desc: Enumerator for $xInit - value: '99' -- name: TEAR_DOWN - desc: Enumerator for $xTearDown - value: '100' - name: SAMPLER_CREATE desc: Enumerator for $xSamplerCreate value: '101' @@ -529,6 +523,12 @@ etors: - name: ADAPTER_GET_INFO desc: Enumerator for $xAdapterGetInfo value: '181' +- name: LOADER_INIT + desc: Enumerator for $xLoaderInit + value: '182' +- name: LOADER_TEAR_DOWN + desc: Enumerator for $xLoaderTearDown + value: '183' --- type: enum desc: Defines structure types diff --git a/scripts/parse_specs.py b/scripts/parse_specs.py index 414b25d8e0..195d53fc5c 100644 --- a/scripts/parse_specs.py +++ b/scripts/parse_specs.py @@ -872,6 +872,7 @@ def parse(section, version, tags, meta, ref): specs = [] files = util.findFiles(path, "*.yml") + files.sort(key = lambda f: 0 if f.endswith('common.yml') else 1) registry = [f for f in files if f.endswith('registry.yml')][0] enum_extensions = [] diff --git a/scripts/templates/api.h.mako b/scripts/templates/api.h.mako index 74ba84beeb..41d6d8f456 100644 --- a/scripts/templates/api.h.mako +++ b/scripts/templates/api.h.mako @@ -151,6 +151,7 @@ typedef struct ${th.subt(n, tags, obj['name'])}_ *${th.subt(n, tags, obj['name'] #endif %for tbl in th.get_pfncbtables(specs, meta, n, tags): %for obj in tbl['functions']: +%if obj['params']: /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for ${th.make_func_name(n, tags, obj)} /// @details Each entry is a pointer to the parameter passed to the function; @@ -167,6 +168,7 @@ typedef struct ${th.make_pfncb_param_type(n, tags, obj)} %if 'condition' in obj: #endif // ${th.subt(n, tags, obj['condition'])} %endif +%endif %endfor %endfor diff --git a/scripts/templates/api.py.mako b/scripts/templates/api.py.mako index 35a2fd6d27..7815f2cf53 100644 --- a/scripts/templates/api.py.mako +++ b/scripts/templates/api.py.mako @@ -175,7 +175,7 @@ class ${N}_DDI: self.__dditable = ${n}_dditable_t() # initialize the UR - self.__dll.${x}Init(0, 0) + self.__dll.${x}LoaderInit(0, 0) %for tbl in tables: # call driver to get function pointers diff --git a/scripts/templates/ldrddi.cpp.mako b/scripts/templates/ldrddi.cpp.mako index 0498ba00dc..0c9a3ed8b0 100644 --- a/scripts/templates/ldrddi.cpp.mako +++ b/scripts/templates/ldrddi.cpp.mako @@ -51,22 +51,7 @@ namespace ur_loader add_local = False %> - %if re.match(r"Init", obj['name']): - for( auto& platform : context->platforms ) - { - if(platform.initStatus != ${X}_RESULT_SUCCESS) - continue; - platform.initStatus = platform.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"]))} ); - } - - %elif re.match(r"\w+TearDown$", th.make_func_name(n, tags, obj)): - - for( auto& platform : context->platforms ) - { - platform.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"]))} ); - } - - %elif re.match(r"\w+AdapterGet$", th.make_func_name(n, tags, obj)): + %if re.match(r"\w+AdapterGet$", th.make_func_name(n, tags, obj)): size_t adapterIndex = 0; if( nullptr != ${obj['params'][1]['name']} && ${obj['params'][0]['name']} !=0) diff --git a/scripts/templates/libapi.cpp.mako b/scripts/templates/libapi.cpp.mako index d269d62241..6fe1f3992b 100644 --- a/scripts/templates/libapi.cpp.mako +++ b/scripts/templates/libapi.cpp.mako @@ -56,19 +56,27 @@ ${th.make_func_name(n, tags, obj)}( %endfor ) try { -%if th.obj_traits.is_loader_only(obj): - return ur_lib::${th.make_func_name(n, tags, obj)}(${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); -%else: %if re.match("Init", obj['name']): + <% + param_checks=th.make_param_checks(n, tags, obj, meta=meta).items() + %> + %for key, values in param_checks: + %for val in values: + if( ${val} ) + return ${key}; + + %endfor + %endfor + static ${x}_result_t result = ${X}_RESULT_SUCCESS; std::call_once(${x}_lib::context->initOnce, [device_flags, hLoaderConfig]() { result = ${x}_lib::context->Init(device_flags, hLoaderConfig); }); - if( ${X}_RESULT_SUCCESS != result ) - return result; - -%endif + return result; +%elif th.obj_traits.is_loader_only(obj): + return ur_lib::${th.make_func_name(n, tags, obj)}(${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); +%else: auto ${th.make_pfn_name(n, tags, obj)} = ${x}_lib::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_UNINITIALIZED; diff --git a/scripts/templates/libddi.cpp.mako b/scripts/templates/libddi.cpp.mako index de73cc2fc7..eae178324c 100644 --- a/scripts/templates/libddi.cpp.mako +++ b/scripts/templates/libddi.cpp.mako @@ -28,7 +28,7 @@ namespace ${x}_lib /////////////////////////////////////////////////////////////////////////////// - __${x}dlllocal ${x}_result_t context_t::${n}Init() + __${x}dlllocal ${x}_result_t context_t::${n}LoaderInit() { ${x}_result_t result = ${X}_RESULT_SUCCESS; diff --git a/scripts/templates/valddi.cpp.mako b/scripts/templates/valddi.cpp.mako index 862c8b81a5..e778d01833 100644 --- a/scripts/templates/valddi.cpp.mako +++ b/scripts/templates/valddi.cpp.mako @@ -64,7 +64,22 @@ namespace ur_validation_layer ${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); - %if func_name in create_retain_release_funcs["create"]: + %if func_name == n + "AdapterRelease": + if( context.enableLeakChecking && result == UR_RESULT_SUCCESS ) + { + refCountContext.decrementRefCount(${object_param}, true); + } + %elif func_name == n + "AdapterRetain": + if( context.enableLeakChecking && result == UR_RESULT_SUCCESS ) + { + refCountContext.decrementRefCount(${object_param}, true); + } + %elif func_name == n + "AdapterGet": + if( context.enableLeakChecking && phAdapters && result == UR_RESULT_SUCCESS ) + { + refCountContext.createOrIncrementRefCount(*phAdapters, true); + } + %elif func_name in create_retain_release_funcs["create"]: if( context.enableLeakChecking && result == UR_RESULT_SUCCESS ) { refCountContext.createRefCount(*${object_param}); @@ -79,12 +94,6 @@ namespace ur_validation_layer { refCountContext.decrementRefCount(${object_param}); } - %elif func_name == n + "TearDown": - if ( context.enableLeakChecking ) - { - refCountContext.logInvalidReferences(); - refCountContext.clear(); - } %endif return result; @@ -170,4 +179,14 @@ namespace ur_validation_layer return result; } + ${x}_result_t context_t::tearDown() { + ${x}_result_t result = ${X}_RESULT_SUCCESS; + + if (enableLeakChecking) { + refCountContext.logInvalidReferences(); + refCountContext.clear(); + } + return result; + } + } // namespace ur_validation_layer diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index f9b8fb4d11..e5efe2b49c 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -12,49 +12,6 @@ #include "ur_null.hpp" namespace driver { -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urInit -__urdlllocal ur_result_t UR_APICALL urInit( - ur_device_init_flags_t device_flags, ///< [in] device initialization flags. - ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. - ur_loader_config_handle_t - hLoaderConfig ///< [in][optional] Handle of loader config handle. - ) try { - ur_result_t result = UR_RESULT_SUCCESS; - - // if the driver has created a custom function, then call it instead of using the generic path - auto pfnInit = d_context.urDdiTable.Global.pfnInit; - if (nullptr != pfnInit) { - result = pfnInit(device_flags, hLoaderConfig); - } else { - // generic implementation - } - - return result; -} catch (...) { - return exceptionToResult(std::current_exception()); -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urTearDown -__urdlllocal ur_result_t UR_APICALL urTearDown( - void *pParams ///< [in] pointer to tear down parameters - ) try { - ur_result_t result = UR_RESULT_SUCCESS; - - // if the driver has created a custom function, then call it instead of using the generic path - auto pfnTearDown = d_context.urDdiTable.Global.pfnTearDown; - if (nullptr != pfnTearDown) { - result = pfnTearDown(pParams); - } else { - // generic implementation - } - - return result; -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urAdapterGet __urdlllocal ur_result_t UR_APICALL urAdapterGet( @@ -5052,10 +5009,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( ur_result_t result = UR_RESULT_SUCCESS; - pDdiTable->pfnInit = driver::urInit; - - pDdiTable->pfnTearDown = driver::urTearDown; - pDdiTable->pfnAdapterGet = driver::urAdapterGet; pDdiTable->pfnAdapterRelease = driver::urAdapterRelease; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 76641dcb65..0fe2ebc9f8 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -825,14 +825,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { os << "UR_FUNCTION_QUEUE_FLUSH"; break; - case UR_FUNCTION_INIT: - os << "UR_FUNCTION_INIT"; - break; - - case UR_FUNCTION_TEAR_DOWN: - os << "UR_FUNCTION_TEAR_DOWN"; - break; - case UR_FUNCTION_SAMPLER_CREATE: os << "UR_FUNCTION_SAMPLER_CREATE"; break; @@ -1141,6 +1133,14 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_ADAPTER_GET_INFO: os << "UR_FUNCTION_ADAPTER_GET_INFO"; break; + + case UR_FUNCTION_LOADER_INIT: + os << "UR_FUNCTION_LOADER_INIT"; + break; + + case UR_FUNCTION_LOADER_TEAR_DOWN: + os << "UR_FUNCTION_LOADER_TEAR_DOWN"; + break; default: os << "unknown enumerator"; break; @@ -9961,32 +9961,6 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } } // namespace ur_params -inline std::ostream &operator<<(std::ostream &os, - const struct ur_init_params_t *params) { - - os << ".device_flags = "; - - ur_params::serializeFlag(os, - *(params->pdevice_flags)); - - os << ", "; - os << ".hLoaderConfig = "; - - ur_params::serializePtr(os, *(params->phLoaderConfig)); - - return os; -} - -inline std::ostream &operator<<(std::ostream &os, - const struct ur_tear_down_params_t *params) { - - os << ".pParams = "; - - ur_params::serializePtr(os, *(params->ppParams)); - - return os; -} - inline std::ostream &operator<<(std::ostream &os, const struct ur_adapter_get_params_t *params) { @@ -13382,6 +13356,29 @@ inline std::ostream &operator<<( return os; } +inline std::ostream &operator<<(std::ostream &os, + const struct ur_loader_init_params_t *params) { + + os << ".device_flags = "; + + ur_params::serializeFlag(os, + *(params->pdevice_flags)); + + os << ", "; + os << ".hLoaderConfig = "; + + ur_params::serializePtr(os, *(params->phLoaderConfig)); + + return os; +} + +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_loader_tear_down_params_t *params) { + + return os; +} + inline std::ostream & operator<<(std::ostream &os, const struct ur_loader_config_create_params_t *params) { @@ -15334,12 +15331,6 @@ template inline void serializePtr(std::ostream &os, const T *ptr) { inline int serializeFunctionParams(std::ostream &os, uint32_t function, const void *params) { switch ((enum ur_function_t)function) { - case UR_FUNCTION_INIT: { - os << (const struct ur_init_params_t *)params; - } break; - case UR_FUNCTION_TEAR_DOWN: { - os << (const struct ur_tear_down_params_t *)params; - } break; case UR_FUNCTION_ADAPTER_GET: { os << (const struct ur_adapter_get_params_t *)params; } break; @@ -15648,6 +15639,12 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_kernel_set_specialization_constants_params_t *) params; } break; + case UR_FUNCTION_LOADER_INIT: { + os << (const struct ur_loader_init_params_t *)params; + } break; + case UR_FUNCTION_LOADER_TEAR_DOWN: { + os << (const struct ur_loader_tear_down_params_t *)params; + } break; case UR_FUNCTION_LOADER_CONFIG_CREATE: { os << (const struct ur_loader_config_create_params_t *)params; } break; diff --git a/source/loader/layers/tracing/ur_tracing_layer.hpp b/source/loader/layers/tracing/ur_tracing_layer.hpp index b00d12d301..04a2d7c857 100644 --- a/source/loader/layers/tracing/ur_tracing_layer.hpp +++ b/source/loader/layers/tracing/ur_tracing_layer.hpp @@ -33,6 +33,7 @@ class __urdlllocal context_t : public proxy_layer_context_t { std::vector getNames() const override { return {name}; } ur_result_t init(ur_dditable_t *dditable, const std::set &enabledLayerNames) override; + ur_result_t tearDown() override { return UR_RESULT_SUCCESS; } uint64_t notify_begin(uint32_t id, const char *name, void *args); void notify_end(uint32_t id, const char *name, void *args, ur_result_t *resultp, uint64_t instance); diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index f30fac3807..3f79c3aa13 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -15,54 +15,6 @@ #include namespace ur_tracing_layer { -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urInit -__urdlllocal ur_result_t UR_APICALL urInit( - ur_device_init_flags_t device_flags, ///< [in] device initialization flags. - ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. - ur_loader_config_handle_t - hLoaderConfig ///< [in][optional] Handle of loader config handle. -) { - auto pfnInit = context.urDdiTable.Global.pfnInit; - - if (nullptr == pfnInit) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - } - - ur_init_params_t params = {&device_flags, &hLoaderConfig}; - uint64_t instance = - context.notify_begin(UR_FUNCTION_INIT, "urInit", ¶ms); - - ur_result_t result = pfnInit(device_flags, hLoaderConfig); - - context.notify_end(UR_FUNCTION_INIT, "urInit", ¶ms, &result, instance); - - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urTearDown -__urdlllocal ur_result_t UR_APICALL urTearDown( - void *pParams ///< [in] pointer to tear down parameters -) { - auto pfnTearDown = context.urDdiTable.Global.pfnTearDown; - - if (nullptr == pfnTearDown) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - } - - ur_tear_down_params_t params = {&pParams}; - uint64_t instance = - context.notify_begin(UR_FUNCTION_TEAR_DOWN, "urTearDown", ¶ms); - - ur_result_t result = pfnTearDown(pParams); - - context.notify_end(UR_FUNCTION_TEAR_DOWN, "urTearDown", ¶ms, &result, - instance); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urAdapterGet __urdlllocal ur_result_t UR_APICALL urAdapterGet( @@ -5828,12 +5780,6 @@ __urdlllocal ur_result_t UR_APICALL urGetGlobalProcAddrTable( ur_result_t result = UR_RESULT_SUCCESS; - dditable.pfnInit = pDdiTable->pfnInit; - pDdiTable->pfnInit = ur_tracing_layer::urInit; - - dditable.pfnTearDown = pDdiTable->pfnTearDown; - pDdiTable->pfnTearDown = ur_tracing_layer::urTearDown; - dditable.pfnAdapterGet = pDdiTable->pfnAdapterGet; pDdiTable->pfnAdapterGet = ur_tracing_layer::urAdapterGet; diff --git a/source/loader/layers/ur_proxy_layer.hpp b/source/loader/layers/ur_proxy_layer.hpp index 782a7e241b..20bb47394e 100644 --- a/source/loader/layers/ur_proxy_layer.hpp +++ b/source/loader/layers/ur_proxy_layer.hpp @@ -27,6 +27,7 @@ class __urdlllocal proxy_layer_context_t { virtual ur_result_t init(ur_dditable_t *dditable, const std::set &enabledLayerNames) = 0; + virtual ur_result_t tearDown() = 0; }; #endif /* UR_PROXY_LAYER_H */ diff --git a/source/loader/layers/validation/ur_leak_check.hpp b/source/loader/layers/validation/ur_leak_check.hpp index 475742fc75..3f3fb80b0b 100644 --- a/source/loader/layers/validation/ur_leak_check.hpp +++ b/source/loader/layers/validation/ur_leak_check.hpp @@ -24,6 +24,7 @@ struct RefCountContext { }; enum RefCountUpdateType { + REFCOUNT_CREATE_OR_INCREASE, REFCOUNT_CREATE, REFCOUNT_INCREASE, REFCOUNT_DECREASE, @@ -31,13 +32,25 @@ struct RefCountContext { std::mutex mutex; std::unordered_map counts; + int64_t adapterCount = 0; - void updateRefCount(void *ptr, enum RefCountUpdateType type) { + void updateRefCount(void *ptr, enum RefCountUpdateType type, + bool isAdapterHandle = false) { std::unique_lock ulock(mutex); auto it = counts.find(ptr); switch (type) { + case REFCOUNT_CREATE_OR_INCREASE: + if (it == counts.end()) { + counts[ptr] = {1, getCurrentBacktrace()}; + if (isAdapterHandle) { + adapterCount++; + } + } else { + counts[ptr].refCount++; + } + break; case REFCOUNT_CREATE: if (it == counts.end()) { counts[ptr] = {1, getCurrentBacktrace()}; @@ -65,6 +78,8 @@ struct RefCountContext { if (counts[ptr].refCount < 0) { context.logger.error( "Attempting to release nonexistent handle {}", ptr); + } else if (counts[ptr].refCount == 0 && isAdapterHandle) { + adapterCount--; } break; } @@ -75,17 +90,27 @@ struct RefCountContext { if (counts[ptr].refCount == 0) { counts.erase(ptr); } + + // No more active adapters, so any references still held are leaked + if (adapterCount == 0) { + logInvalidReferences(); + clear(); + } } public: void createRefCount(void *ptr) { updateRefCount(ptr, REFCOUNT_CREATE); } - void incrementRefCount(void *ptr) { - updateRefCount(ptr, REFCOUNT_INCREASE); + void incrementRefCount(void *ptr, bool isAdapterHandle = false) { + updateRefCount(ptr, REFCOUNT_INCREASE, isAdapterHandle); + } + + void decrementRefCount(void *ptr, bool isAdapterHandle = false) { + updateRefCount(ptr, REFCOUNT_DECREASE, isAdapterHandle); } - void decrementRefCount(void *ptr) { - updateRefCount(ptr, REFCOUNT_DECREASE); + void createOrIncrementRefCount(void *ptr, bool isAdapterHandle = false) { + updateRefCount(ptr, REFCOUNT_CREATE_OR_INCREASE, isAdapterHandle); } void clear() { counts.clear(); } diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 46b0eef491..08cf04c672 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -14,58 +14,6 @@ namespace ur_validation_layer { -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urInit -__urdlllocal ur_result_t UR_APICALL urInit( - ur_device_init_flags_t device_flags, ///< [in] device initialization flags. - ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. - ur_loader_config_handle_t - hLoaderConfig ///< [in][optional] Handle of loader config handle. -) { - auto pfnInit = context.urDdiTable.Global.pfnInit; - - if (nullptr == pfnInit) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - if (context.enableParameterValidation) { - if (UR_DEVICE_INIT_FLAGS_MASK & device_flags) { - return UR_RESULT_ERROR_INVALID_ENUMERATION; - } - } - - ur_result_t result = pfnInit(device_flags, hLoaderConfig); - - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urTearDown -__urdlllocal ur_result_t UR_APICALL urTearDown( - void *pParams ///< [in] pointer to tear down parameters -) { - auto pfnTearDown = context.urDdiTable.Global.pfnTearDown; - - if (nullptr == pfnTearDown) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - if (context.enableParameterValidation) { - if (NULL == pParams) { - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - } - } - - ur_result_t result = pfnTearDown(pParams); - - if (context.enableLeakChecking) { - refCountContext.logInvalidReferences(); - refCountContext.clear(); - } - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urAdapterGet __urdlllocal ur_result_t UR_APICALL urAdapterGet( @@ -92,6 +40,11 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet( ur_result_t result = pfnAdapterGet(NumEntries, phAdapters, pNumAdapters); + if (context.enableLeakChecking && phAdapters && + result == UR_RESULT_SUCCESS) { + refCountContext.createOrIncrementRefCount(*phAdapters, true); + } + return result; } @@ -115,7 +68,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRelease( ur_result_t result = pfnAdapterRelease(hAdapter); if (context.enableLeakChecking && result == UR_RESULT_SUCCESS) { - refCountContext.decrementRefCount(hAdapter); + refCountContext.decrementRefCount(hAdapter, true); } return result; @@ -141,7 +94,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain( ur_result_t result = pfnAdapterRetain(hAdapter); if (context.enableLeakChecking && result == UR_RESULT_SUCCESS) { - refCountContext.incrementRefCount(hAdapter); + refCountContext.decrementRefCount(hAdapter, true); } return result; @@ -7183,12 +7136,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( ur_result_t result = UR_RESULT_SUCCESS; - dditable.pfnInit = pDdiTable->pfnInit; - pDdiTable->pfnInit = ur_validation_layer::urInit; - - dditable.pfnTearDown = pDdiTable->pfnTearDown; - pDdiTable->pfnTearDown = ur_validation_layer::urTearDown; - dditable.pfnAdapterGet = pDdiTable->pfnAdapterGet; pDdiTable->pfnAdapterGet = ur_validation_layer::urAdapterGet; @@ -8409,4 +8356,14 @@ ur_result_t context_t::init(ur_dditable_t *dditable, return result; } +ur_result_t context_t::tearDown() { + ur_result_t result = UR_RESULT_SUCCESS; + + if (enableLeakChecking) { + refCountContext.logInvalidReferences(); + refCountContext.clear(); + } + return result; +} + } // namespace ur_validation_layer diff --git a/source/loader/layers/validation/ur_validation_layer.hpp b/source/loader/layers/validation/ur_validation_layer.hpp index 3201a5345e..bab9e56e88 100644 --- a/source/loader/layers/validation/ur_validation_layer.hpp +++ b/source/loader/layers/validation/ur_validation_layer.hpp @@ -35,6 +35,7 @@ class __urdlllocal context_t : public proxy_layer_context_t { } ur_result_t init(ur_dditable_t *dditable, const std::set &enabledLayerNames) override; + ur_result_t tearDown() override; private: const std::string nameFullValidation = "UR_LAYER_FULL_VALIDATION"; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index e192088bbc..ce615c9945 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -33,41 +33,6 @@ ur_exp_interop_mem_factory_t ur_exp_interop_mem_factory; ur_exp_interop_semaphore_factory_t ur_exp_interop_semaphore_factory; ur_exp_command_buffer_factory_t ur_exp_command_buffer_factory; -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urInit -__urdlllocal ur_result_t UR_APICALL urInit( - ur_device_init_flags_t device_flags, ///< [in] device initialization flags. - ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. - ur_loader_config_handle_t - hLoaderConfig ///< [in][optional] Handle of loader config handle. -) { - ur_result_t result = UR_RESULT_SUCCESS; - - for (auto &platform : context->platforms) { - if (platform.initStatus != UR_RESULT_SUCCESS) { - continue; - } - platform.initStatus = - platform.dditable.ur.Global.pfnInit(device_flags, hLoaderConfig); - } - - return result; -} - -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urTearDown -__urdlllocal ur_result_t UR_APICALL urTearDown( - void *pParams ///< [in] pointer to tear down parameters -) { - ur_result_t result = UR_RESULT_SUCCESS; - - for (auto &platform : context->platforms) { - platform.dditable.ur.Global.pfnTearDown(pParams); - } - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urAdapterGet __urdlllocal ur_result_t UR_APICALL urAdapterGet( @@ -6994,8 +6959,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (ur_loader::context->platforms.size() != 1 || ur_loader::context->forceIntercept) { // return pointers to loader's DDIs - pDdiTable->pfnInit = ur_loader::urInit; - pDdiTable->pfnTearDown = ur_loader::urTearDown; pDdiTable->pfnAdapterGet = ur_loader::urAdapterGet; pDdiTable->pfnAdapterRelease = ur_loader::urAdapterRelease; pDdiTable->pfnAdapterRetain = ur_loader::urAdapterRetain; diff --git a/source/loader/ur_lib.cpp b/source/loader/ur_lib.cpp index 964da234f1..e1c0ed5e2f 100644 --- a/source/loader/ur_lib.cpp +++ b/source/loader/ur_lib.cpp @@ -60,6 +60,14 @@ void context_t::initLayers() const { } } +void context_t::tearDownLayers() const { + for (auto &l : layers) { + if (l->isAvailable()) { + l->tearDown(); + } + } +} + ////////////////////////////////////////////////////////////////////////// __urdlllocal ur_result_t context_t::Init(ur_device_init_flags_t device_flags, @@ -72,7 +80,7 @@ context_t::Init(ur_device_init_flags_t device_flags, result = ur_loader::context->init(); if (UR_RESULT_SUCCESS == result) { - result = urInit(); + result = urLoaderInit(); } if (hLoaderConfig) { @@ -174,4 +182,10 @@ ur_result_t urLoaderConfigEnableLayer(ur_loader_config_handle_t hLoaderConfig, hLoaderConfig->enabledLayers.insert(pLayerName); return UR_RESULT_SUCCESS; } + +ur_result_t urLoaderTearDown() { + context->tearDownLayers(); + + return UR_RESULT_SUCCESS; +} } // namespace ur_lib diff --git a/source/loader/ur_lib.hpp b/source/loader/ur_lib.hpp index 1f0f23658b..58ee62b936 100644 --- a/source/loader/ur_lib.hpp +++ b/source/loader/ur_lib.hpp @@ -60,7 +60,7 @@ class __urdlllocal context_t { ur_result_t Init(ur_device_init_flags_t dflags, ur_loader_config_handle_t hLoaderConfig); - ur_result_t urInit(); + ur_result_t urLoaderInit(); ur_dditable_t urDdiTable = {}; const std::vector layers = { @@ -75,6 +75,7 @@ class __urdlllocal context_t { bool layerExists(const std::string &layerName) const; void parseEnvEnabledLayers(); void initLayers() const; + void tearDownLayers() const; }; extern context_t *context; @@ -87,5 +88,6 @@ ur_result_t urLoaderConfigGetInfo(ur_loader_config_handle_t hLoaderConfig, size_t *pPropSizeRet); ur_result_t urLoaderConfigEnableLayer(ur_loader_config_handle_t hLoaderConfig, const char *pLayerName); +ur_result_t urLoaderTearDown(); } // namespace ur_lib #endif /* UR_LOADER_LIB_H */ diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 7a64efd088..e7a75147a5 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -158,21 +158,21 @@ ur_result_t UR_APICALL urLoaderConfigEnableLayer( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Initialize the 'oneAPI' adapter(s) +/// @brief Initialize the 'oneAPI' loader /// /// @details /// - The application must call this function before calling any other /// function. /// - If this function is not called then all other functions will return /// ::UR_RESULT_ERROR_UNINITIALIZED. -/// - Only one instance of each adapter will be initialized per process. +/// - Only one instance of the loader will be initialized per process. /// - The application may call this function multiple times with different /// flags or environment variables enabled. /// - The application must call this function after forking new processes. /// Each forked process must call this function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe for scenarios -/// where multiple libraries may initialize the adapter(s) simultaneously. +/// where multiple libraries may initialize the loader simultaneously. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -182,51 +182,38 @@ ur_result_t UR_APICALL urLoaderConfigEnableLayer( /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_DEVICE_INIT_FLAGS_MASK & device_flags` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urInit( +ur_result_t UR_APICALL urLoaderInit( ur_device_init_flags_t device_flags, ///< [in] device initialization flags. ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. ur_loader_config_handle_t hLoaderConfig ///< [in][optional] Handle of loader config handle. ) try { + + if (UR_DEVICE_INIT_FLAGS_MASK & device_flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + static ur_result_t result = UR_RESULT_SUCCESS; std::call_once(ur_lib::context->initOnce, [device_flags, hLoaderConfig]() { result = ur_lib::context->Init(device_flags, hLoaderConfig); }); - if (UR_RESULT_SUCCESS != result) { - return result; - } - - auto pfnInit = ur_lib::context->urDdiTable.Global.pfnInit; - if (nullptr == pfnInit) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - return pfnInit(device_flags, hLoaderConfig); + return result; } catch (...) { return exceptionToResult(std::current_exception()); } /////////////////////////////////////////////////////////////////////////////// -/// @brief Tear down the 'oneAPI' instance and release all its resources +/// @brief Tear down the 'oneAPI' loader and release all its resources /// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == pParams` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urTearDown( - void *pParams ///< [in] pointer to tear down parameters - ) try { - auto pfnTearDown = ur_lib::context->urDdiTable.Global.pfnTearDown; - if (nullptr == pfnTearDown) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - return pfnTearDown(pParams); +ur_result_t UR_APICALL urLoaderTearDown(void) try { + return ur_lib::urLoaderTearDown(); } catch (...) { return exceptionToResult(std::current_exception()); } @@ -280,7 +267,9 @@ ur_result_t UR_APICALL urAdapterGet( /// /// @details /// - When the reference count of the adapter reaches zero, the adapter may -/// perform adapter-specififc resource teardown +/// perform adapter-specififc resource teardown. Resources must be left in +/// a state where it safe for the adapter to be subsequently reinitialized +/// with ::urAdapterGet /// /// @returns /// - ::UR_RESULT_SUCCESS diff --git a/source/loader/ur_libddi.cpp b/source/loader/ur_libddi.cpp index 1328a2b071..912449b54e 100644 --- a/source/loader/ur_libddi.cpp +++ b/source/loader/ur_libddi.cpp @@ -17,7 +17,7 @@ namespace ur_lib { /////////////////////////////////////////////////////////////////////////////// -__urdlllocal ur_result_t context_t::urInit() { +__urdlllocal ur_result_t context_t::urLoaderInit() { ur_result_t result = UR_RESULT_SUCCESS; if (UR_RESULT_SUCCESS == result) { diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 456c584d68..e841204835 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -149,21 +149,21 @@ ur_result_t UR_APICALL urLoaderConfigEnableLayer( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Initialize the 'oneAPI' adapter(s) +/// @brief Initialize the 'oneAPI' loader /// /// @details /// - The application must call this function before calling any other /// function. /// - If this function is not called then all other functions will return /// ::UR_RESULT_ERROR_UNINITIALIZED. -/// - Only one instance of each adapter will be initialized per process. +/// - Only one instance of the loader will be initialized per process. /// - The application may call this function multiple times with different /// flags or environment variables enabled. /// - The application must call this function after forking new processes. /// Each forked process must call this function. /// - The application may call this function from simultaneous threads. /// - The implementation of this function must be thread-safe for scenarios -/// where multiple libraries may initialize the adapter(s) simultaneously. +/// where multiple libraries may initialize the loader simultaneously. /// /// @returns /// - ::UR_RESULT_SUCCESS @@ -173,7 +173,7 @@ ur_result_t UR_APICALL urLoaderConfigEnableLayer( /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_DEVICE_INIT_FLAGS_MASK & device_flags` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urInit( +ur_result_t UR_APICALL urLoaderInit( ur_device_init_flags_t device_flags, ///< [in] device initialization flags. ///< must be 0 (default) or a combination of ::ur_device_init_flag_t. ur_loader_config_handle_t @@ -184,19 +184,15 @@ ur_result_t UR_APICALL urInit( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Tear down the 'oneAPI' instance and release all its resources +/// @brief Tear down the 'oneAPI' loader and release all its resources /// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED /// - ::UR_RESULT_ERROR_DEVICE_LOST /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == pParams` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY -ur_result_t UR_APICALL urTearDown( - void *pParams ///< [in] pointer to tear down parameters -) { +ur_result_t UR_APICALL urLoaderTearDown(void) { ur_result_t result = UR_RESULT_SUCCESS; return result; } @@ -244,7 +240,9 @@ ur_result_t UR_APICALL urAdapterGet( /// /// @details /// - When the reference count of the adapter reaches zero, the adapter may -/// perform adapter-specififc resource teardown +/// perform adapter-specififc resource teardown. Resources must be left in +/// a state where it safe for the adapter to be subsequently reinitialized +/// with ::urAdapterGet /// /// @returns /// - ::UR_RESULT_SUCCESS diff --git a/test/conformance/CMakeLists.txt b/test/conformance/CMakeLists.txt index 2cb78a9106..b64f9798d4 100644 --- a/test/conformance/CMakeLists.txt +++ b/test/conformance/CMakeLists.txt @@ -46,7 +46,7 @@ endfunction() add_subdirectory(testing) -add_subdirectory(runtime) +add_subdirectory(adapter) add_subdirectory(platform) add_subdirectory(device) add_subdirectory(context) diff --git a/test/conformance/runtime/CMakeLists.txt b/test/conformance/adapter/CMakeLists.txt similarity index 77% rename from test/conformance/runtime/CMakeLists.txt rename to test/conformance/adapter/CMakeLists.txt index 8c46abd82b..8d71a3cf6a 100644 --- a/test/conformance/runtime/CMakeLists.txt +++ b/test/conformance/adapter/CMakeLists.txt @@ -3,11 +3,9 @@ # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -add_conformance_test(runtime +add_conformance_test(adapter urAdapterGet.cpp urAdapterGetInfo.cpp urAdapterGetLastError.cpp urAdapterRetain.cpp - urAdapterRelease.cpp - urInit.cpp - urTearDown.cpp) + urAdapterRelease.cpp) diff --git a/test/conformance/runtime/fixtures.h b/test/conformance/adapter/fixtures.h similarity index 89% rename from test/conformance/runtime/fixtures.h rename to test/conformance/adapter/fixtures.h index 04f72617dd..31b2a2265d 100644 --- a/test/conformance/runtime/fixtures.h +++ b/test/conformance/adapter/fixtures.h @@ -14,15 +14,14 @@ struct urTest : ::testing::Test { ASSERT_SUCCESS(urLoaderConfigCreate(&loader_config)); ASSERT_SUCCESS(urLoaderConfigEnableLayer(loader_config, "UR_LAYER_FULL_VALIDATION")); - ASSERT_SUCCESS(urInit(device_flags, loader_config)); + ASSERT_SUCCESS(urLoaderInit(device_flags, loader_config)); } void TearDown() override { if (loader_config) { ASSERT_SUCCESS(urLoaderConfigRelease(loader_config)); } - ur_tear_down_params_t tear_down_params{}; - ASSERT_SUCCESS(urTearDown(&tear_down_params)); + ASSERT_SUCCESS(urLoaderTearDown()); } ur_loader_config_handle_t loader_config = nullptr; @@ -35,6 +34,7 @@ struct urAdapterTest : urTest { uint32_t adapter_count; ASSERT_SUCCESS(urAdapterGet(0, nullptr, &adapter_count)); + ASSERT_GT(adapter_count, 0); adapters.resize(adapter_count); ASSERT_SUCCESS(urAdapterGet(adapter_count, adapters.data(), nullptr)); } diff --git a/test/conformance/runtime/urAdapterGet.cpp b/test/conformance/adapter/urAdapterGet.cpp similarity index 100% rename from test/conformance/runtime/urAdapterGet.cpp rename to test/conformance/adapter/urAdapterGet.cpp diff --git a/test/conformance/runtime/urAdapterGetInfo.cpp b/test/conformance/adapter/urAdapterGetInfo.cpp similarity index 100% rename from test/conformance/runtime/urAdapterGetInfo.cpp rename to test/conformance/adapter/urAdapterGetInfo.cpp diff --git a/test/conformance/runtime/urAdapterGetLastError.cpp b/test/conformance/adapter/urAdapterGetLastError.cpp similarity index 100% rename from test/conformance/runtime/urAdapterGetLastError.cpp rename to test/conformance/adapter/urAdapterGetLastError.cpp diff --git a/test/conformance/runtime/urAdapterRelease.cpp b/test/conformance/adapter/urAdapterRelease.cpp similarity index 100% rename from test/conformance/runtime/urAdapterRelease.cpp rename to test/conformance/adapter/urAdapterRelease.cpp diff --git a/test/conformance/runtime/urAdapterRetain.cpp b/test/conformance/adapter/urAdapterRetain.cpp similarity index 100% rename from test/conformance/runtime/urAdapterRetain.cpp rename to test/conformance/adapter/urAdapterRetain.cpp diff --git a/test/conformance/platform/fixtures.h b/test/conformance/platform/fixtures.h index 5b532fb433..b294e7031a 100644 --- a/test/conformance/platform/fixtures.h +++ b/test/conformance/platform/fixtures.h @@ -17,7 +17,7 @@ struct urTest : ::testing::Test { ASSERT_SUCCESS(urLoaderConfigCreate(&loader_config)); ASSERT_SUCCESS(urLoaderConfigEnableLayer(loader_config, "UR_LAYER_FULL_VALIDATION")); - ASSERT_SUCCESS(urInit(device_flags, loader_config)); + ASSERT_SUCCESS(urLoaderInit(device_flags, loader_config)); uint32_t adapter_count; ASSERT_SUCCESS(urAdapterGet(0, nullptr, &adapter_count)); @@ -32,8 +32,7 @@ struct urTest : ::testing::Test { if (loader_config) { ASSERT_SUCCESS(urLoaderConfigRelease(loader_config)); } - ur_tear_down_params_t tear_down_params{}; - ASSERT_SUCCESS(urTearDown(&tear_down_params)); + ASSERT_SUCCESS(urLoaderTearDown()); } ur_loader_config_handle_t loader_config = nullptr; diff --git a/test/conformance/runtime/urTearDown.cpp b/test/conformance/runtime/urTearDown.cpp deleted file mode 100644 index 3639515f82..0000000000 --- a/test/conformance/runtime/urTearDown.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2022-2023 Intel Corporation -// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. -// See LICENSE.TXT -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include - -struct urTearDownTest : testing::Test { - void SetUp() override { - ur_device_init_flags_t device_flags = 0; - ASSERT_SUCCESS(urInit(device_flags, nullptr)); - } -}; - -TEST_F(urTearDownTest, Success) { - ur_tear_down_params_t tear_down_params{}; - ASSERT_SUCCESS(urTearDown(&tear_down_params)); -} - -TEST_F(urTearDownTest, InvalidNullPointerParams) { - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER, urTearDown(nullptr)); -} diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 287310f679..92b84f4b4d 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -57,7 +57,7 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) } ur_device_init_flags_t device_flags = 0; - auto initResult = urInit(device_flags, config); + auto initResult = urLoaderInit(device_flags, config); auto configReleaseResult = urLoaderConfigRelease(config); switch (initResult) { case UR_RESULT_SUCCESS: @@ -66,7 +66,7 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) error = ERROR_NO_ADAPTER; return; default: - error = "urInit() failed"; + error = "urLoaderInit() failed"; return; } @@ -159,9 +159,8 @@ void uur::PlatformEnvironment::TearDown() { for (auto adapter : adapters) { urAdapterRelease(adapter); } - ur_tear_down_params_t tear_down_params{}; - if (urTearDown(&tear_down_params)) { - FAIL() << "urTearDown() failed"; + if (urLoaderTearDown()) { + FAIL() << "urLoaderTearDown() failed"; } } diff --git a/test/layers/tracing/hello_world.out.match b/test/layers/tracing/hello_world.out.match index 7658650d04..cef17b8fdf 100644 --- a/test/layers/tracing/hello_world.out.match +++ b/test/layers/tracing/hello_world.out.match @@ -1,27 +1,23 @@ -function_with_args_begin(1) - urInit(.device_flags = 0); -function_with_args_end(1) - urInit(...) -> ur_result_t(0); Platform initialized. -function_with_args_begin(2) - urAdapterGet(unimplemented); +function_with_args_begin(1) - urAdapterGet(.NumEntries = 0, .phAdapters = {{.*}}, .pNumAdapters = {{.*}}); +function_with_args_end(1) - urAdapterGet(...) -> ur_result_t(0); +function_with_args_begin(2) - urAdapterGet(.NumEntries = 1, .phAdapters = {{.*}}, .pNumAdapters = {{.*}}); function_with_args_end(2) - urAdapterGet(...) -> ur_result_t(0); -function_with_args_begin(3) - urAdapterGet(unimplemented); -function_with_args_end(3) - urAdapterGet(...) -> ur_result_t(0); +function_with_args_begin(3) - urPlatformGet(unimplemented); +function_with_args_end(3) - urPlatformGet(...) -> ur_result_t(0); function_with_args_begin(4) - urPlatformGet(unimplemented); function_with_args_end(4) - urPlatformGet(...) -> ur_result_t(0); -function_with_args_begin(5) - urPlatformGet(unimplemented); -function_with_args_end(5) - urPlatformGet(...) -> ur_result_t(0); -function_with_args_begin(6) - urPlatformGetApiVersion(unimplemented); -function_with_args_end(6) - urPlatformGetApiVersion(...) -> ur_result_t(0); +function_with_args_begin(5) - urPlatformGetApiVersion(unimplemented); +function_with_args_end(5) - urPlatformGetApiVersion(...) -> ur_result_t(0); API version: {{0\.[0-9]+}} +function_with_args_begin(6) - urDeviceGet(unimplemented); +function_with_args_end(6) - urDeviceGet(...) -> ur_result_t(0); function_with_args_begin(7) - urDeviceGet(unimplemented); function_with_args_end(7) - urDeviceGet(...) -> ur_result_t(0); -function_with_args_begin(8) - urDeviceGet(unimplemented); -function_with_args_end(8) - urDeviceGet(...) -> ur_result_t(0); +function_with_args_begin(8) - urDeviceGetInfo(unimplemented); +function_with_args_end(8) - urDeviceGetInfo(...) -> ur_result_t(0); function_with_args_begin(9) - urDeviceGetInfo(unimplemented); function_with_args_end(9) - urDeviceGetInfo(...) -> ur_result_t(0); -function_with_args_begin(10) - urDeviceGetInfo(unimplemented); -function_with_args_end(10) - urDeviceGetInfo(...) -> ur_result_t(0); Found a Null Device gpu. -function_with_args_begin(11) - urAdapterRelease(unimplemented); -function_with_args_end(11) - urAdapterRelease(...) -> ur_result_t(0); -function_with_args_begin(12) - urTearDown(unimplemented); -function_with_args_end(12) - urTearDown(...) -> ur_result_t(0); +function_with_args_begin(10) - urAdapterRelease(unimplemented); +function_with_args_end(10) - urAdapterRelease(...) -> ur_result_t(0); diff --git a/test/layers/validation/fixtures.hpp b/test/layers/validation/fixtures.hpp index a41e48b3a4..ab92ba1e01 100644 --- a/test/layers/validation/fixtures.hpp +++ b/test/layers/validation/fixtures.hpp @@ -17,15 +17,14 @@ struct urTest : ::testing::Test { "UR_LAYER_FULL_VALIDATION"), UR_RESULT_SUCCESS); ur_device_init_flags_t device_flags = 0; - ASSERT_EQ(urInit(device_flags, loader_config), UR_RESULT_SUCCESS); + ASSERT_EQ(urLoaderInit(device_flags, loader_config), UR_RESULT_SUCCESS); } void TearDown() override { if (loader_config) { ASSERT_EQ(urLoaderConfigRelease(loader_config), UR_RESULT_SUCCESS); } - ur_tear_down_params_t tear_down_params{}; - ASSERT_EQ(urTearDown(&tear_down_params), UR_RESULT_SUCCESS); + ASSERT_EQ(urLoaderTearDown(), UR_RESULT_SUCCESS); } ur_loader_config_handle_t loader_config = nullptr; @@ -53,7 +52,12 @@ struct valPlatformsTest : urTest { UR_RESULT_SUCCESS); } - void TearDown() override { urTest::TearDown(); } + void TearDown() override { + for (auto &adapter : adapters) { + ASSERT_EQ(urAdapterRelease(adapter), UR_RESULT_SUCCESS); + } + urTest::TearDown(); + } std::vector adapters; std::vector platforms; diff --git a/test/layers/validation/leaks.cpp b/test/layers/validation/leaks.cpp index b0df81207e..e32aeafc89 100644 --- a/test/layers/validation/leaks.cpp +++ b/test/layers/validation/leaks.cpp @@ -5,6 +5,12 @@ #include "fixtures.hpp" +TEST_F(urTest, testUrAdapterGetLeak) { + ur_adapter_handle_t adapter = nullptr; + ASSERT_EQ(urAdapterGet(1, &adapter, nullptr), UR_RESULT_SUCCESS); + ASSERT_NE(nullptr, adapter); +} + TEST_F(valDeviceTest, testUrContextCreateLeak) { ur_context_handle_t context = nullptr; ASSERT_EQ(urContextCreate(1, &device, nullptr, &context), diff --git a/test/layers/validation/leaks.out.match b/test/layers/validation/leaks.out.match index aadba2252c..9fac722527 100644 --- a/test/layers/validation/leaks.out.match +++ b/test/layers/validation/leaks.out.match @@ -3,28 +3,45 @@ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 +\[ERROR\]: Retained 1 reference\(s\) to handle [0-9xa-fA-F]+ +\[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: +(.*) +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 2 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained 2 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[ERROR\]: Attempting to retain nonexistent handle [0-9xa-fA-F]+ (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 2 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained -1 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained -1 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) diff --git a/test/layers/validation/leaks_mt.out.match b/test/layers/validation/leaks_mt.out.match index 7d5a0bedd8..86de1e1d76 100644 --- a/test/layers/validation/leaks_mt.out.match +++ b/test/layers/validation/leaks_mt.out.match @@ -1,10 +1,13 @@ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 2 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 3 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained 3 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 2 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 3 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 4 @@ -13,17 +16,21 @@ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 7 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 8 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 9 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained 9 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained -1 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -1 @@ -39,18 +46,22 @@ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -6 \[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -7 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained -7 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained 1 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ @@ -67,6 +78,7 @@ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to [1-9]+ \[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 +\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 0 \[ERROR\]: Retained 1 reference\(s\) to handle [0-9xa-fA-F]+ \[ERROR\]: Handle [0-9xa-fA-F]+ was recorded for first time here: (.*) diff --git a/test/layers/validation/parameters.cpp b/test/layers/validation/parameters.cpp index ee679363dc..c02afd63d6 100644 --- a/test/layers/validation/parameters.cpp +++ b/test/layers/validation/parameters.cpp @@ -5,18 +5,6 @@ #include "fixtures.hpp" -TEST(valTest, urInit) { - ur_loader_config_handle_t config; - urLoaderConfigCreate(&config); - urLoaderConfigEnableLayer(config, "UR_PARAMETER_VALIDATION_LAYER"); - - const ur_device_init_flags_t device_flags = - UR_DEVICE_INIT_FLAG_FORCE_UINT32; - ASSERT_EQ(urInit(device_flags, config), - UR_RESULT_ERROR_INVALID_ENUMERATION); - ASSERT_EQ(urLoaderConfigRelease(config), UR_RESULT_SUCCESS); -} - TEST_F(valPlatformsTest, testUrPlatformGetApiVersion) { ur_api_version_t api_version = {}; diff --git a/test/loader/CMakeLists.txt b/test/loader/CMakeLists.txt index 0dbf999c45..d36f922098 100644 --- a/test/loader/CMakeLists.txt +++ b/test/loader/CMakeLists.txt @@ -10,4 +10,5 @@ set_tests_properties(example-hello-world PROPERTIES LABELS "loader" add_subdirectory(adapter_registry) add_subdirectory(loader_config) +add_subdirectory(loader_lifetime) add_subdirectory(platforms) diff --git a/test/loader/loader_lifetime/CMakeLists.txt b/test/loader/loader_lifetime/CMakeLists.txt new file mode 100644 index 0000000000..c76ff87d0b --- /dev/null +++ b/test/loader/loader_lifetime/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright (C) 2023 Intel Corporation +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +add_executable(test-loader-lifetime + urLoaderInit.cpp + urLoaderTearDown.cpp +) + +target_link_libraries(test-loader-lifetime + PRIVATE + ${PROJECT_NAME}::common + ${PROJECT_NAME}::headers + ${PROJECT_NAME}::loader + gmock + GTest::gtest_main +) + +add_test(NAME loader-lifetime + COMMAND test-loader-lifetime + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) diff --git a/test/loader/loader_lifetime/fixtures.hpp b/test/loader/loader_lifetime/fixtures.hpp new file mode 100644 index 0000000000..b1eb3766c5 --- /dev/null +++ b/test/loader/loader_lifetime/fixtures.hpp @@ -0,0 +1,27 @@ +// Copyright (C) 2023 Intel Corporation +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +// See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#ifndef UR_LOADER_CONFIG_TEST_FIXTURES_H +#define UR_LOADER_CONFIG_TEST_FIXTURES_H + +#include "ur_api.h" +#include +#include + +#ifndef ASSERT_SUCCESS +#define ASSERT_SUCCESS(ACTUAL) ASSERT_EQ(UR_RESULT_SUCCESS, ACTUAL) +#endif + +/// @brief Make a string a valid identifier for gtest. +/// @param str The string to sanitize. +inline std::string GTestSanitizeString(const std::string &str) { + auto str_cpy = str; + std::replace_if( + str_cpy.begin(), str_cpy.end(), [](char c) { return !std::isalnum(c); }, + '_'); + return str_cpy; +} + +#endif diff --git a/test/conformance/runtime/urInit.cpp b/test/loader/loader_lifetime/urLoaderInit.cpp similarity index 67% rename from test/conformance/runtime/urInit.cpp rename to test/loader/loader_lifetime/urLoaderInit.cpp index 1de30ff471..48060240b8 100644 --- a/test/conformance/runtime/urInit.cpp +++ b/test/loader/loader_lifetime/urLoaderInit.cpp @@ -2,11 +2,13 @@ // Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. // See LICENSE.TXT // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include +#include "fixtures.hpp" +#include -using urInitTestWithParam = ::testing::TestWithParam; +using urLoaderInitTestWithParam = + ::testing::TestWithParam; INSTANTIATE_TEST_SUITE_P( - , urInitTestWithParam, + , urLoaderInitTestWithParam, ::testing::Values(UR_DEVICE_INIT_FLAG_GPU, UR_DEVICE_INIT_FLAG_CPU, UR_DEVICE_INIT_FLAG_FPGA, UR_DEVICE_INIT_FLAG_MCA, UR_DEVICE_INIT_FLAG_VPU, @@ -16,24 +18,23 @@ INSTANTIATE_TEST_SUITE_P( [](const ::testing::TestParamInfo &info) { std::stringstream ss; ur_params::serializeFlag(ss, info.param); - return uur::GTestSanitizeString(ss.str()); + return GTestSanitizeString(ss.str()); }); -TEST_P(urInitTestWithParam, Success) { +TEST_P(urLoaderInitTestWithParam, Success) { ur_loader_config_handle_t config = nullptr; urLoaderConfigCreate(&config); urLoaderConfigEnableLayer(config, "UR_LAYER_FULL_VALIDATION"); ur_device_init_flags_t device_flags = GetParam(); - ASSERT_SUCCESS(urInit(device_flags, config)); + ASSERT_SUCCESS(urLoaderInit(device_flags, config)); - ur_tear_down_params_t tear_down_params{nullptr}; - ASSERT_SUCCESS(urTearDown(&tear_down_params)); + ASSERT_SUCCESS(urLoaderTearDown()); } -TEST(urInitTest, ErrorInvalidEnumerationDeviceFlags) { +TEST(urLoaderInitTest, ErrorInvalidEnumerationDeviceFlags) { const ur_device_init_flags_t device_flags = UR_DEVICE_INIT_FLAG_FORCE_UINT32; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, - urInit(device_flags, nullptr)); + ASSERT_EQ(UR_RESULT_ERROR_INVALID_ENUMERATION, + urLoaderInit(device_flags, nullptr)); } diff --git a/test/loader/loader_lifetime/urLoaderTearDown.cpp b/test/loader/loader_lifetime/urLoaderTearDown.cpp new file mode 100644 index 0000000000..a4c3dc83fb --- /dev/null +++ b/test/loader/loader_lifetime/urLoaderTearDown.cpp @@ -0,0 +1,14 @@ +// Copyright (C) 2022-2023 Intel Corporation +// Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +// See LICENSE.TXT +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include "fixtures.hpp" + +struct urLoaderTearDownTest : testing::Test { + void SetUp() override { + ur_device_init_flags_t device_flags = 0; + ASSERT_SUCCESS(urLoaderInit(device_flags, nullptr)); + } +}; + +TEST_F(urLoaderTearDownTest, Success) { ASSERT_SUCCESS(urLoaderTearDown()); } diff --git a/test/loader/platforms/no_platforms.match b/test/loader/platforms/no_platforms.match index da17800c0c..b695672e4d 100644 --- a/test/loader/platforms/no_platforms.match +++ b/test/loader/platforms/no_platforms.match @@ -1,2 +1,2 @@ -[INFO]: urInit succeeded. +[INFO]: urLoaderInit succeeded. [INFO]: urPlatformGet found 0 platforms diff --git a/test/loader/platforms/null_platform.match b/test/loader/platforms/null_platform.match index 6c7d8a97f4..29cadc78b5 100644 --- a/test/loader/platforms/null_platform.match +++ b/test/loader/platforms/null_platform.match @@ -1,3 +1,3 @@ -[INFO]: urInit succeeded. +[INFO]: urLoaderInit succeeded. [INFO]: urPlatformGet found 1 platforms -[INFO]: Found UR_PLATFORM_NULL \ No newline at end of file +[INFO]: Found UR_PLATFORM_NULL diff --git a/test/loader/platforms/platforms.cpp b/test/loader/platforms/platforms.cpp index 2a665fe8d6..bf85ae9cf4 100644 --- a/test/loader/platforms/platforms.cpp +++ b/test/loader/platforms/platforms.cpp @@ -24,12 +24,12 @@ int main(int argc, char *argv[]) { ur_result_t status; // Initialize the platform - status = urInit(0, nullptr); + status = urLoaderInit(0, nullptr); if (status != UR_RESULT_SUCCESS) { - error("urInit failed with return code: {}", status); + error("urLoaderInit failed with return code: {}", status); return 1; } - info("urInit succeeded."); + info("urLoaderInit succeeded."); uint32_t adapterCount = 0; std::vector adapters; @@ -89,6 +89,6 @@ int main(int argc, char *argv[]) { free(name); } out: - urTearDown(nullptr); + urLoaderTearDown(); return status == UR_RESULT_SUCCESS ? 0 : 1; } diff --git a/test/tools/urtrace/null_hello.match b/test/tools/urtrace/null_hello.match index b58a4d8d96..54c6efb9cb 100644 --- a/test/tools/urtrace/null_hello.match +++ b/test/tools/urtrace/null_hello.match @@ -1,4 +1,3 @@ -urInit(.device_flags = 0, .hLoaderConfig = nullptr) -> UR_RESULT_SUCCESS; Platform initialized. urAdapterGet(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (1)) -> UR_RESULT_SUCCESS; urAdapterGet(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr) -> UR_RESULT_SUCCESS; @@ -12,4 +11,3 @@ urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_TYPE, .propSize = urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = {{.*}}, .pPropValue = {{.*}}, .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS; Found a Null Device gpu. urAdapterRelease(.hAdapter = {{.*}}) -> UR_RESULT_SUCCESS; -urTearDown(.pParams = nullptr) -> UR_RESULT_SUCCESS; diff --git a/test/tools/urtrace/null_hello_begin.match b/test/tools/urtrace/null_hello_begin.match index 81c15da60f..bf2d85145a 100644 --- a/test/tools/urtrace/null_hello_begin.match +++ b/test/tools/urtrace/null_hello_begin.match @@ -1,27 +1,23 @@ -begin(1) - urInit(.device_flags = 0, .hLoaderConfig = nullptr); -end(1) - urInit(.device_flags = 0, .hLoaderConfig = nullptr) -> UR_RESULT_SUCCESS; Platform initialized. -begin(2) - urAdapterGet(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (0)); -end(2) - urAdapterGet(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (1)) -> UR_RESULT_SUCCESS; -begin(3) - urAdapterGet(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr); -end(3) - urAdapterGet(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr) -> UR_RESULT_SUCCESS; -begin(4) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {}, .pNumPlatforms = {{.*}} (0)); -end(4) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {}, .pNumPlatforms = {{.*}} (1)) -> UR_RESULT_SUCCESS; -begin(5) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {nullptr}, .pNumPlatforms = nullptr); -end(5) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {{{.*}}}, .pNumPlatforms = nullptr) -> UR_RESULT_SUCCESS; -begin(6) - urPlatformGetApiVersion(.hPlatform = {{.*}}, .pVersion = {{.*}} (0.0)); -end(6) - urPlatformGetApiVersion(.hPlatform = {{.*}}, .pVersion = {{.*}} (@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@)) -> UR_RESULT_SUCCESS; +begin(1) - urAdapterGet(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (0)); +end(1) - urAdapterGet(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (1)) -> UR_RESULT_SUCCESS; +begin(2) - urAdapterGet(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr); +end(2) - urAdapterGet(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr) -> UR_RESULT_SUCCESS; +begin(3) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {}, .pNumPlatforms = {{.*}} (0)); +end(3) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {}, .pNumPlatforms = {{.*}} (1)) -> UR_RESULT_SUCCESS; +begin(4) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {nullptr}, .pNumPlatforms = nullptr); +end(4) - urPlatformGet(.phAdapters = {{{.*}}}, .NumAdapters = 1, .NumEntries = 1, .phPlatforms = {{{.*}}}, .pNumPlatforms = nullptr) -> UR_RESULT_SUCCESS; +begin(5) - urPlatformGetApiVersion(.hPlatform = {{.*}}, .pVersion = {{.*}} (0.0)); +end(5) - urPlatformGetApiVersion(.hPlatform = {{.*}}, .pVersion = {{.*}} (@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@)) -> UR_RESULT_SUCCESS; API version: {{.*}} -begin(7) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 0, .phDevices = {}, .pNumDevices = {{.*}} (0)); -end(7) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 0, .phDevices = {}, .pNumDevices = {{.*}} (1)) -> UR_RESULT_SUCCESS; -begin(8) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 1, .phDevices = {nullptr}, .pNumDevices = nullptr); -end(8) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 1, .phDevices = {{{.*}}}, .pNumDevices = nullptr) -> UR_RESULT_SUCCESS; -begin(9) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_TYPE, .propSize = 4, .pPropValue = {{.*}}, .pPropSizeRet = nullptr); -end(9) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_TYPE, .propSize = 4, .pPropValue = {{.*}}, .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS; -begin(10) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = 1023, .pPropValue = {{.*}}, .pPropSizeRet = nullptr); -end(10) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = 1023, .pPropValue = {{.*}}, .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS; +begin(6) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 0, .phDevices = {}, .pNumDevices = {{.*}} (0)); +end(6) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 0, .phDevices = {}, .pNumDevices = {{.*}} (1)) -> UR_RESULT_SUCCESS; +begin(7) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 1, .phDevices = {nullptr}, .pNumDevices = nullptr); +end(7) - urDeviceGet(.hPlatform = {{.*}}, .DeviceType = UR_DEVICE_TYPE_GPU, .NumEntries = 1, .phDevices = {{{.*}}}, .pNumDevices = nullptr) -> UR_RESULT_SUCCESS; +begin(8) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_TYPE, .propSize = 4, .pPropValue = {{.*}}, .pPropSizeRet = nullptr); +end(8) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_TYPE, .propSize = 4, .pPropValue = {{.*}}, .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS; +begin(9) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = 1023, .pPropValue = {{.*}}, .pPropSizeRet = nullptr); +end(9) - urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = 1023, .pPropValue = {{.*}}, .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS; Found a Null Device gpu. -begin(11) - urAdapterRelease(.hAdapter = {{.*}}); -end(11) - urAdapterRelease(.hAdapter = {{.*}}) -> UR_RESULT_SUCCESS; -begin(12) - urTearDown(.pParams = nullptr); -end(12) - urTearDown(.pParams = nullptr) -> UR_RESULT_SUCCESS; +begin(10) - urAdapterRelease(.hAdapter = {{.*}}); +end(10) - urAdapterRelease(.hAdapter = {{.*}}) -> UR_RESULT_SUCCESS; diff --git a/test/tools/urtrace/null_hello_json.match b/test/tools/urtrace/null_hello_json.match index 18c5fbac78..5b9377e8d6 100644 --- a/test/tools/urtrace/null_hello_json.match +++ b/test/tools/urtrace/null_hello_json.match @@ -1,6 +1,5 @@ { "traceEvents": [ -{ "cat": "UR", "ph": "X", "pid": {{.*}}, "tid": {{.*}}, "ts": {{.*}}, "dur": {{.*}}, "name": "urInit", "args": "(.device_flags = 0, .hLoaderConfig = nullptr)" }, Platform initialized. { "cat": "UR", "ph": "X", "pid": {{.*}}, "tid": {{.*}}, "ts": {{.*}}, "dur": {{.*}}, "name": "urAdapterGet", "args": "(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (1))" }, { "cat": "UR", "ph": "X", "pid": {{.*}}, "tid": {{.*}}, "ts": {{.*}}, "dur": {{.*}}, "name": "urAdapterGet", "args": "(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr)" }, @@ -14,7 +13,6 @@ API version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@ { "cat": "UR", "ph": "X", "pid": {{.*}}, "tid": {{.*}}, "ts": {{.*}}, "dur": {{.*}}, "name": "urDeviceGetInfo", "args": "(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = 1023, .pPropValue = {{.*}} (Null Device), .pPropSizeRet = nullptr)" }, Found a Null Device gpu. { "cat": "UR", "ph": "X", "pid": {{.*}}, "tid": {{.*}}, "ts": {{.*}}, "dur": {{.*}}, "name": "urAdapterRelease", "args": "(.hAdapter = {{.*}})" }, -{ "cat": "UR", "ph": "X", "pid": {{.*}}, "tid": {{.*}}, "ts": {{.*}}, "dur": {{.*}}, "name": "urTearDown", "args": "(.pParams = nullptr)" }, {"name": "", "cat": "", "ph": "", "pid": "", "tid": "", "ts": ""} ] } diff --git a/test/tools/urtrace/null_hello_no_args.match b/test/tools/urtrace/null_hello_no_args.match index e0afcd2868..6462f41d02 100644 --- a/test/tools/urtrace/null_hello_no_args.match +++ b/test/tools/urtrace/null_hello_no_args.match @@ -1,4 +1,3 @@ -urInit(...) -> UR_RESULT_SUCCESS; Platform initialized. urAdapterGet(...) -> UR_RESULT_SUCCESS; urAdapterGet(...) -> UR_RESULT_SUCCESS; @@ -12,4 +11,3 @@ urDeviceGetInfo(...) -> UR_RESULT_SUCCESS; urDeviceGetInfo(...) -> UR_RESULT_SUCCESS; Found a Null Device gpu. urAdapterRelease(...) -> UR_RESULT_SUCCESS; -urTearDown(...) -> UR_RESULT_SUCCESS; diff --git a/test/tools/urtrace/null_hello_profiling.match b/test/tools/urtrace/null_hello_profiling.match index 635c3c8784..7bd3bd53c1 100644 --- a/test/tools/urtrace/null_hello_profiling.match +++ b/test/tools/urtrace/null_hello_profiling.match @@ -1,4 +1,3 @@ -urInit(.device_flags = 0, .hLoaderConfig = nullptr) -> UR_RESULT_SUCCESS; ({{[0-9]+}}ns) Platform initialized. urAdapterGet(.NumEntries = 0, .phAdapters = {}, .pNumAdapters = {{.*}} (1)) -> UR_RESULT_SUCCESS; ({{[0-9]+}}ns) urAdapterGet(.NumEntries = 1, .phAdapters = {{{.*}}}, .pNumAdapters = nullptr) -> UR_RESULT_SUCCESS; ({{[0-9]+}}ns) @@ -12,4 +11,3 @@ urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_TYPE, .propSize = urDeviceGetInfo(.hDevice = {{.*}}, .propName = UR_DEVICE_INFO_NAME, .propSize = {{.*}}, .pPropValue = {{.*}}, .pPropSizeRet = nullptr) -> UR_RESULT_SUCCESS; ({{[0-9]+}}ns) Found a Null Device gpu. urAdapterRelease(.hAdapter = {{.*}}) -> UR_RESULT_SUCCESS; ({{[0-9]+}}ns) -urTearDown(.pParams = nullptr) -> UR_RESULT_SUCCESS; ({{[0-9]+}}ns) diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index 964d117e49..d54263591b 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -17,30 +17,30 @@ template class ParamsTest : public testing::Test { T params; }; -struct UrInitParams { - ur_init_params_t params; +struct UrLoaderInitParams { + ur_loader_init_params_t params; ur_device_init_flags_t flags; ur_loader_config_handle_t config; - UrInitParams(ur_device_init_flags_t _flags) + UrLoaderInitParams(ur_device_init_flags_t _flags) : flags(_flags), config(nullptr) { params.pdevice_flags = &flags; params.phLoaderConfig = &config; } - ur_init_params_t *get_struct() { return ¶ms; } + ur_loader_init_params_t *get_struct() { return ¶ms; } }; -struct UrInitParamsNoFlags : UrInitParams { - UrInitParamsNoFlags() : UrInitParams(0) {} +struct UrLoaderInitParamsNoFlags : UrLoaderInitParams { + UrLoaderInitParamsNoFlags() : UrLoaderInitParams(0) {} const char *get_expected() { return ".device_flags = 0, .hLoaderConfig = nullptr"; }; }; -struct UrInitParamsInvalidFlags : UrInitParams { - UrInitParamsInvalidFlags() - : UrInitParams(UR_DEVICE_INIT_FLAG_GPU | UR_DEVICE_INIT_FLAG_MCA | - UR_BIT(25) | UR_BIT(30) | UR_BIT(31)) {} +struct UrLoaderInitParamsInvalidFlags : UrLoaderInitParams { + UrLoaderInitParamsInvalidFlags() + : UrLoaderInitParams(UR_DEVICE_INIT_FLAG_GPU | UR_DEVICE_INIT_FLAG_MCA | + UR_BIT(25) | UR_BIT(30) | UR_BIT(31)) {} const char *get_expected() { return ".device_flags = UR_DEVICE_INIT_FLAG_GPU \\| " "UR_DEVICE_INIT_FLAG_MCA \\| unknown bit flags " @@ -368,14 +368,15 @@ struct UrDevicePartitionPropertyTest { }; using testing::Types; -typedef Types< - UrInitParamsNoFlags, UrInitParamsInvalidFlags, UrUsmHostAllocParamsEmpty, - UrPlatformGetEmptyArray, UrPlatformGetTwoPlatforms, - UrUsmHostAllocParamsUsmDesc, UrUsmHostAllocParamsHostDesc, - UrDeviceGetInfoParamsEmpty, UrDeviceGetInfoParamsName, - UrDeviceGetInfoParamsQueueFlag, UrDeviceGetInfoParamsPartitionArray, - UrContextGetInfoParamsDevicesArray, UrDeviceGetInfoParamsInvalidSize, - UrProgramMetadataTest, UrDevicePartitionPropertyTest> +typedef Types Implementations; using ::testing::MatchesRegex; From 790384e22d02283d17d30e335b3352ab91084594 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Mon, 28 Aug 2023 11:41:26 +0100 Subject: [PATCH 005/145] [UR] Refactor CTS parser to use JSON output from tests --- scripts/ctest_parser.py | 170 ++++++++++++++++++---------------------- 1 file changed, 78 insertions(+), 92 deletions(-) diff --git a/scripts/ctest_parser.py b/scripts/ctest_parser.py index 0530290df1..d84bbc8f01 100644 --- a/scripts/ctest_parser.py +++ b/scripts/ctest_parser.py @@ -7,120 +7,106 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception """ -from sys import argv -from subprocess import PIPE, Popen, STDOUT +from subprocess import Popen, DEVNULL import argparse import os +import json +TMP_RESULTS_FILE = "tmp-results-file.json" +CTS_TEST_SUITES = ["context", "device", "enqueue", "event", "kernel", "memory", + "platform", "program", "queue", "runtime", "sampler", "usm", + "virtual_memory"] -def run(command, env): - process = Popen(command, env=env, stdout=PIPE, - stderr=STDOUT, cwd=command[1]) - lines = process.communicate()[0].decode('utf-8').splitlines() - results = {"Passed": {}, "Skipped": {}, "Failed": {}, 'Total': 0, 'Success': True} - for line in lines: - result_types = ['[ OK ]', '[ FAILED ]', '[ SKIPPED ]'] - if any([x in line for x in result_types]) and line.endswith("ms)"): - name, time = line[line.find(']') + 2:].split(' ', maxsplit=1) - if 'OK' in line: - results['Passed'][name] = {'time': time} - elif 'SKIPPED' in line: - results['Skipped'][name] = {'time': time} - elif 'FAILED' in line: - results['Failed'][name] = {'time': time} - elif '[==========] Running' in line: - # This is the start of a new test suite, get the number of tests in - # the first line e.g: '[==========] Running 29 tests from 9 test suites.' - total = line[line.find('g') + 2:line.find('t') - 1] - results['Total'] += int(total) - - if process.returncode != 0: - results['Success'] = False +def percent(amount, total): + return round((amount / total) * 100, 2) - return results - - -def print_results(results, result_type): - print('[CTest Parser] {} tests: '.format(result_type)) - print("\n".join("\t{}\t{}".format(k, v['time']) - for k, v in results.items())) - - -def print_summary(total, total_passed, total_failed, total_skipped, total_crashed): - pass_rate_incl_skipped = str(round((total_passed / total) * 100, 2)) - total_excl_skipped = total - total_skipped - pass_rate_excl_skipped = str( - round((total_passed / total_excl_skipped) * 100, 2)) +def summarize_results(results): + total = results['Total'] + total_passed = len(results['Passed']) + total_skipped = len(results['Skipped']) + total_failed = len(results['Failed']) - skipped_rate = str(round((total_skipped / total) * 100, 2)) - failed_rate = str(round((total_failed / total) * 100, 2)) - crashed_rate = str(round((total_crashed / total) * 100, 2)) + pass_rate_incl_skipped = percent(total_passed, total) + pass_rate_excl_skipped = percent(total_passed, total - total_skipped) - print('[CTest Parser] Results:') - print('\tTotal\t[{}]'. format(total)) - print('\tPassed\t[{}]\t({}%) - ({}% with skipped tests excluded)'.format( - total_passed, pass_rate_incl_skipped, pass_rate_excl_skipped)) - print('\tSkipped\t[{}]\t({}%)'.format(total_skipped, skipped_rate)) - print('\tFailed\t[{}]\t({}%)'.format(total_failed, failed_rate)) - print('\tCrashed\t[{}]\t({}%)'.format(total_crashed, crashed_rate)) + skipped_rate = percent(total_skipped, total) + failed_rate = percent(total_failed, total) + ljust_param = len(str(total)) + + print( +f"""[CTest Parser] Results: + Total [{str(total).ljust(ljust_param)}] + Passed [{str(total_passed).ljust(ljust_param)}] ({pass_rate_incl_skipped}%) - ({pass_rate_excl_skipped}% with skipped tests excluded) + Skipped [{str(total_skipped).ljust(ljust_param)}] ({skipped_rate}%) + Failed [{str(total_failed).ljust(ljust_param)}] ({failed_rate}%) +""" + ) + +def parse_results(results): + parsed_results = {"Passed": {}, "Skipped":{}, "Failed": {}, 'Total':0, 'Success':True} + for _, result in results.items(): + if result is None: + parsed_results['Success'] = False + continue + + parsed_results['Total'] += result['tests'] + for testsuite in result.get('testsuites'): + for test in testsuite.get('testsuite'): + test_name = f"{testsuite['name']}.{test['name']}" + test_time = test['time'] + if 'failures' in test: + parsed_results['Failed'][test_name] = {'time': test_time} + elif test['result'] == 'SKIPPED': + parsed_results['Skipped'][test_name] = {'time': test_time} + else: + parsed_results['Passed'][test_name] = {'time': test_time} + return parsed_results + + +def run(args): + results = {} + + tmp_results_file = f"{args.ctest_path}/{TMP_RESULTS_FILE}" + env = os.environ.copy() + env['GTEST_OUTPUT'] = f"json:{tmp_results_file}" + + for suite in CTS_TEST_SUITES: + ctest_path = f"{args.ctest_path}/test/conformance/{suite}" + process = Popen(['ctest',ctest_path], env=env, cwd=ctest_path, + stdout=DEVNULL if args.quiet else None, + stderr=DEVNULL if args.quiet else None) + process.wait() + + try: + with open(tmp_results_file, 'r') as results_file: + json_data = json.load(results_file) + results[suite] = json_data + os.remove(tmp_results_file) + except FileNotFoundError: + results[suite] = None + print('\033[91m' + f"Conformance test suite '{suite}' : likely crashed!" + '\033[0m') + + return results def dir_path(string): if os.path.isdir(string): - return string + return os.path.abspath(string) else: raise NotADirectoryError(string) - def main(): - parser = argparse.ArgumentParser( - description='CTest Result Parser. Parses output from CTest and ' - 'summarises test results. -VV argument is always passed to ' - 'CTest capture full output.') - + parser = argparse.ArgumentParser() parser.add_argument('ctest_path', type=dir_path, nargs='?', default='.', help='Optional path to test directory containing ' 'CTestTestfile. Defaults to current directory.') parser.add_argument('-q', '--quiet', action='store_true', help='Output only failed tests.') - args = parser.parse_args() - path = args.ctest_path - command = ['ctest', path, '-VV'] - - env = os.environ.copy() - env['GTEST_COLOR'] = 'no' - env['CTEST_OUTPUT_ON_FAILURE'] = '0' - env['GTEST_BRIEF'] = '0' - env['GTEST_PRINT_TIME'] = '1' - env['GTEST_PRINT_UTF8'] = '1' - - results = run(command, env) - - total = results['Total'] - total_passed = len(results['Passed']) - total_skipped = len(results['Skipped']) - total_failed = len(results['Failed']) - total_crashed = total - (total_passed + total_skipped + total_failed) - - if total > 0: - print("[CTest Parser] Preparing results...") - if args.quiet == False: - if total_passed > 0: - print_results(results['Passed'], 'Passed') - if total_skipped > 0: - print_results(results['Skipped'], 'Skipped') - if total_failed > 0: - print_results(results['Failed'], 'Failed') - - print_summary(total, total_passed, total_failed, - total_skipped, total_crashed) - if results['Success'] == False: - exit(1) - else: - print("[CTest Parser] Error: no tests were run") - + raw_results = run(args) + parsed_results = parse_results(raw_results) + summarize_results(parsed_results) if __name__ == '__main__': try: From 40a6846ec8c65f3ee3ee3fee97ea4c27859ef193 Mon Sep 17 00:00:00 2001 From: Ben Tracy Date: Mon, 21 Aug 2023 17:56:48 +0100 Subject: [PATCH 006/145] [CMDBUF] Add fill commands to cmd buffer exp feature - Adds USM and Buffer fill append commands - Update feature spec for new commands - Align naming conventions for Append* commands with core equivalents --- include/ur.py | 104 +++--- include/ur_api.h | 178 ++++++++-- include/ur_ddi.h | 69 ++-- scripts/core/EXP-COMMAND-BUFFER.rst | 54 ++-- scripts/core/exp-command-buffer.yml | 103 +++++- scripts/core/registry.yml | 48 +-- source/adapters/null/ur_nullddi.cpp | 188 +++++++---- source/common/ur_params.hpp | 222 ++++++++++--- source/loader/layers/tracing/ur_trcddi.cpp | 303 ++++++++++++------ source/loader/layers/validation/ur_valddi.cpp | 263 +++++++++++---- source/loader/ur_ldrddi.cpp | 204 ++++++++---- source/loader/ur_libapi.cpp | 177 ++++++++-- source/ur_api.cpp | 103 +++++- 13 files changed, 1493 insertions(+), 523 deletions(-) diff --git a/include/ur.py b/include/ur.py index 2f47142381..0a43f828ae 100644 --- a/include/ur.py +++ b/include/ur.py @@ -142,9 +142,6 @@ class ur_function_v(IntEnum): COMMAND_BUFFER_FINALIZE_EXP = 123 ## Enumerator for ::urCommandBufferFinalizeExp COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP = 125 ## Enumerator for ::urCommandBufferAppendKernelLaunchExp COMMAND_BUFFER_ENQUEUE_EXP = 128 ## Enumerator for ::urCommandBufferEnqueueExp - COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP = 129 ## Enumerator for ::urCommandBufferAppendMemcpyUSMExp - COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP = 130 ## Enumerator for ::urCommandBufferAppendMembufferCopyExp - COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP = 131 ## Enumerator for ::urCommandBufferAppendMembufferCopyRectExp USM_PITCHED_ALLOC_EXP = 132 ## Enumerator for ::urUSMPitchedAllocExp BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP = 133## Enumerator for ::urBindlessImagesUnsampledImageHandleDestroyExp BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP = 134 ## Enumerator for ::urBindlessImagesSampledImageHandleDestroyExp @@ -180,10 +177,6 @@ class ur_function_v(IntEnum): USM_P2P_ENABLE_PEER_ACCESS_EXP = 165 ## Enumerator for ::urUsmP2PEnablePeerAccessExp USM_P2P_DISABLE_PEER_ACCESS_EXP = 166 ## Enumerator for ::urUsmP2PDisablePeerAccessExp USM_P2P_PEER_ACCESS_GET_INFO_EXP = 167 ## Enumerator for ::urUsmP2PPeerAccessGetInfoExp - COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP = 168 ## Enumerator for ::urCommandBufferAppendMembufferWriteExp - COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP = 169 ## Enumerator for ::urCommandBufferAppendMembufferReadExp - COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP = 170## Enumerator for ::urCommandBufferAppendMembufferWriteRectExp - COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP = 171 ## Enumerator for ::urCommandBufferAppendMembufferReadRectExp LOADER_CONFIG_CREATE = 172 ## Enumerator for ::urLoaderConfigCreate LOADER_CONFIG_RELEASE = 173 ## Enumerator for ::urLoaderConfigRelease LOADER_CONFIG_RETAIN = 174 ## Enumerator for ::urLoaderConfigRetain @@ -196,6 +189,15 @@ class ur_function_v(IntEnum): ADAPTER_GET_INFO = 181 ## Enumerator for ::urAdapterGetInfo LOADER_INIT = 182 ## Enumerator for ::urLoaderInit LOADER_TEAR_DOWN = 183 ## Enumerator for ::urLoaderTearDown + COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 184 ## Enumerator for ::urCommandBufferAppendUSMMemcpyExp + COMMAND_BUFFER_APPEND_USM_FILL_EXP = 185 ## Enumerator for ::urCommandBufferAppendUSMFillExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 186 ## Enumerator for ::urCommandBufferAppendMemBufferCopyExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 187## Enumerator for ::urCommandBufferAppendMemBufferWriteExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 188 ## Enumerator for ::urCommandBufferAppendMemBufferReadExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 189## Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190 ## Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191## Enumerator for ::urCommandBufferAppendMemBufferReadRectExp + COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192 ## Enumerator for ::urCommandBufferAppendMemBufferFillExp class ur_function_t(c_int): def __str__(self): @@ -3484,53 +3486,67 @@ class ur_usm_exp_dditable_t(Structure): _urCommandBufferAppendKernelLaunchExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMemcpyUSMExp +## @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp if __use_win_types: - _urCommandBufferAppendMemcpyUSMExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMMemcpyExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMemcpyUSMExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMMemcpyExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMembufferCopyExp +## @brief Function-pointer for urCommandBufferAppendUSMFillExp if __use_win_types: - _urCommandBufferAppendMembufferCopyExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMFillExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMembufferCopyExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMFillExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_void_p, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMembufferWriteExp +## @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp if __use_win_types: - _urCommandBufferAppendMembufferWriteExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferCopyExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMembufferWriteExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferCopyExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMembufferReadExp +## @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp if __use_win_types: - _urCommandBufferAppendMembufferReadExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferWriteExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMembufferReadExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferWriteExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMembufferCopyRectExp +## @brief Function-pointer for urCommandBufferAppendMemBufferReadExp if __use_win_types: - _urCommandBufferAppendMembufferCopyRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferReadExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMembufferCopyRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferReadExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMembufferWriteRectExp +## @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp if __use_win_types: - _urCommandBufferAppendMembufferWriteRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferCopyRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMembufferWriteRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferCopyRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### -## @brief Function-pointer for urCommandBufferAppendMembufferReadRectExp +## @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp if __use_win_types: - _urCommandBufferAppendMembufferReadRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferWriteRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendMembufferReadRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendMemBufferWriteRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + +############################################################################### +## @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp +if __use_win_types: + _urCommandBufferAppendMemBufferReadRectExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMemBufferReadRectExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, c_size_t, c_size_t, c_size_t, c_size_t, c_void_p, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + +############################################################################### +## @brief Function-pointer for urCommandBufferAppendMemBufferFillExp +if __use_win_types: + _urCommandBufferAppendMemBufferFillExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_void_p, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendMemBufferFillExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_void_p, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp @@ -3549,13 +3565,15 @@ class ur_command_buffer_exp_dditable_t(Structure): ("pfnReleaseExp", c_void_p), ## _urCommandBufferReleaseExp_t ("pfnFinalizeExp", c_void_p), ## _urCommandBufferFinalizeExp_t ("pfnAppendKernelLaunchExp", c_void_p), ## _urCommandBufferAppendKernelLaunchExp_t - ("pfnAppendMemcpyUSMExp", c_void_p), ## _urCommandBufferAppendMemcpyUSMExp_t - ("pfnAppendMembufferCopyExp", c_void_p), ## _urCommandBufferAppendMembufferCopyExp_t - ("pfnAppendMembufferWriteExp", c_void_p), ## _urCommandBufferAppendMembufferWriteExp_t - ("pfnAppendMembufferReadExp", c_void_p), ## _urCommandBufferAppendMembufferReadExp_t - ("pfnAppendMembufferCopyRectExp", c_void_p), ## _urCommandBufferAppendMembufferCopyRectExp_t - ("pfnAppendMembufferWriteRectExp", c_void_p), ## _urCommandBufferAppendMembufferWriteRectExp_t - ("pfnAppendMembufferReadRectExp", c_void_p), ## _urCommandBufferAppendMembufferReadRectExp_t + ("pfnAppendUSMMemcpyExp", c_void_p), ## _urCommandBufferAppendUSMMemcpyExp_t + ("pfnAppendUSMFillExp", c_void_p), ## _urCommandBufferAppendUSMFillExp_t + ("pfnAppendMemBufferCopyExp", c_void_p), ## _urCommandBufferAppendMemBufferCopyExp_t + ("pfnAppendMemBufferWriteExp", c_void_p), ## _urCommandBufferAppendMemBufferWriteExp_t + ("pfnAppendMemBufferReadExp", c_void_p), ## _urCommandBufferAppendMemBufferReadExp_t + ("pfnAppendMemBufferCopyRectExp", c_void_p), ## _urCommandBufferAppendMemBufferCopyRectExp_t + ("pfnAppendMemBufferWriteRectExp", c_void_p), ## _urCommandBufferAppendMemBufferWriteRectExp_t + ("pfnAppendMemBufferReadRectExp", c_void_p), ## _urCommandBufferAppendMemBufferReadRectExp_t + ("pfnAppendMemBufferFillExp", c_void_p), ## _urCommandBufferAppendMemBufferFillExp_t ("pfnEnqueueExp", c_void_p) ## _urCommandBufferEnqueueExp_t ] @@ -4045,13 +4063,15 @@ def __init__(self, version : ur_api_version_t): self.urCommandBufferReleaseExp = _urCommandBufferReleaseExp_t(self.__dditable.CommandBufferExp.pfnReleaseExp) self.urCommandBufferFinalizeExp = _urCommandBufferFinalizeExp_t(self.__dditable.CommandBufferExp.pfnFinalizeExp) self.urCommandBufferAppendKernelLaunchExp = _urCommandBufferAppendKernelLaunchExp_t(self.__dditable.CommandBufferExp.pfnAppendKernelLaunchExp) - self.urCommandBufferAppendMemcpyUSMExp = _urCommandBufferAppendMemcpyUSMExp_t(self.__dditable.CommandBufferExp.pfnAppendMemcpyUSMExp) - self.urCommandBufferAppendMembufferCopyExp = _urCommandBufferAppendMembufferCopyExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferCopyExp) - self.urCommandBufferAppendMembufferWriteExp = _urCommandBufferAppendMembufferWriteExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferWriteExp) - self.urCommandBufferAppendMembufferReadExp = _urCommandBufferAppendMembufferReadExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferReadExp) - self.urCommandBufferAppendMembufferCopyRectExp = _urCommandBufferAppendMembufferCopyRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferCopyRectExp) - self.urCommandBufferAppendMembufferWriteRectExp = _urCommandBufferAppendMembufferWriteRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferWriteRectExp) - self.urCommandBufferAppendMembufferReadRectExp = _urCommandBufferAppendMembufferReadRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMembufferReadRectExp) + self.urCommandBufferAppendUSMMemcpyExp = _urCommandBufferAppendUSMMemcpyExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMMemcpyExp) + self.urCommandBufferAppendUSMFillExp = _urCommandBufferAppendUSMFillExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMFillExp) + self.urCommandBufferAppendMemBufferCopyExp = _urCommandBufferAppendMemBufferCopyExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferCopyExp) + self.urCommandBufferAppendMemBufferWriteExp = _urCommandBufferAppendMemBufferWriteExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferWriteExp) + self.urCommandBufferAppendMemBufferReadExp = _urCommandBufferAppendMemBufferReadExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferReadExp) + self.urCommandBufferAppendMemBufferCopyRectExp = _urCommandBufferAppendMemBufferCopyRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferCopyRectExp) + self.urCommandBufferAppendMemBufferWriteRectExp = _urCommandBufferAppendMemBufferWriteRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferWriteRectExp) + self.urCommandBufferAppendMemBufferReadRectExp = _urCommandBufferAppendMemBufferReadRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferReadRectExp) + self.urCommandBufferAppendMemBufferFillExp = _urCommandBufferAppendMemBufferFillExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferFillExp) self.urCommandBufferEnqueueExp = _urCommandBufferEnqueueExp_t(self.__dditable.CommandBufferExp.pfnEnqueueExp) # call driver to get function pointers diff --git a/include/ur_api.h b/include/ur_api.h index 30696c2932..1508dcf86b 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -151,9 +151,6 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP = 123, ///< Enumerator for ::urCommandBufferFinalizeExp UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP = 125, ///< Enumerator for ::urCommandBufferAppendKernelLaunchExp UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP = 128, ///< Enumerator for ::urCommandBufferEnqueueExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP = 129, ///< Enumerator for ::urCommandBufferAppendMemcpyUSMExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP = 130, ///< Enumerator for ::urCommandBufferAppendMembufferCopyExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP = 131, ///< Enumerator for ::urCommandBufferAppendMembufferCopyRectExp UR_FUNCTION_USM_PITCHED_ALLOC_EXP = 132, ///< Enumerator for ::urUSMPitchedAllocExp UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP = 133, ///< Enumerator for ::urBindlessImagesUnsampledImageHandleDestroyExp UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP = 134, ///< Enumerator for ::urBindlessImagesSampledImageHandleDestroyExp @@ -189,10 +186,6 @@ typedef enum ur_function_t { UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP = 165, ///< Enumerator for ::urUsmP2PEnablePeerAccessExp UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP = 166, ///< Enumerator for ::urUsmP2PDisablePeerAccessExp UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP = 167, ///< Enumerator for ::urUsmP2PPeerAccessGetInfoExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP = 168, ///< Enumerator for ::urCommandBufferAppendMembufferWriteExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP = 169, ///< Enumerator for ::urCommandBufferAppendMembufferReadExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP = 170, ///< Enumerator for ::urCommandBufferAppendMembufferWriteRectExp - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP = 171, ///< Enumerator for ::urCommandBufferAppendMembufferReadRectExp UR_FUNCTION_LOADER_CONFIG_CREATE = 172, ///< Enumerator for ::urLoaderConfigCreate UR_FUNCTION_LOADER_CONFIG_RELEASE = 173, ///< Enumerator for ::urLoaderConfigRelease UR_FUNCTION_LOADER_CONFIG_RETAIN = 174, ///< Enumerator for ::urLoaderConfigRetain @@ -205,6 +198,15 @@ typedef enum ur_function_t { UR_FUNCTION_ADAPTER_GET_INFO = 181, ///< Enumerator for ::urAdapterGetInfo UR_FUNCTION_LOADER_INIT = 182, ///< Enumerator for ::urLoaderInit UR_FUNCTION_LOADER_TEAR_DOWN = 183, ///< Enumerator for ::urLoaderTearDown + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP = 184, ///< Enumerator for ::urCommandBufferAppendUSMMemcpyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP = 185, ///< Enumerator for ::urCommandBufferAppendUSMFillExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP = 186, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP = 187, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP = 188, ///< Enumerator for ::urCommandBufferAppendMemBufferReadExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP = 189, ///< Enumerator for ::urCommandBufferAppendMemBufferCopyRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191, ///< Enumerator for ::urCommandBufferAppendMemBufferReadRectExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -7777,7 +7779,7 @@ urCommandBufferAppendKernelLaunchExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMemcpyUSMExp( +urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. const void *pSrc, ///< [in] The data to be copied. @@ -7787,6 +7789,45 @@ urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a memory copy command to a command-buffer object /// @@ -7808,7 +7849,7 @@ urCommandBufferAppendMemcpyUSMExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferCopyExp( +urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. ur_mem_handle_t hDstMem, ///< [in] The location the data will be copied to. @@ -7842,7 +7883,7 @@ urCommandBufferAppendMembufferCopyExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferWriteExp( +urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. size_t offset, ///< [in] offset in bytes in the buffer object. @@ -7875,7 +7916,7 @@ urCommandBufferAppendMembufferWriteExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferReadExp( +urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. size_t offset, ///< [in] offset in bytes in the buffer object. @@ -7907,7 +7948,7 @@ urCommandBufferAppendMembufferReadExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferCopyRectExp( +urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. ur_mem_handle_t hDstMem, ///< [in] The location the data will be copied to. @@ -7945,7 +7986,7 @@ urCommandBufferAppendMembufferCopyRectExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferWriteRectExp( +urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. @@ -7986,7 +8027,7 @@ urCommandBufferAppendMembufferWriteRectExp( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL -urCommandBufferAppendMembufferReadRectExp( +urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. ur_rect_offset_t bufferOffset, ///< [in] 3D offset in the buffer. @@ -8004,6 +8045,42 @@ urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// @@ -9918,10 +9995,10 @@ typedef struct ur_command_buffer_append_kernel_launch_exp_params_t { } ur_command_buffer_append_kernel_launch_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMemcpyUSMExp +/// @brief Function parameters for urCommandBufferAppendUSMMemcpyExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_memcpy_usm_exp_params_t { +typedef struct ur_command_buffer_append_usm_memcpy_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; void **ppDst; const void **ppSrc; @@ -9929,13 +10006,28 @@ typedef struct ur_command_buffer_append_memcpy_usm_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_memcpy_usm_exp_params_t; +} ur_command_buffer_append_usm_memcpy_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMFillExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_fill_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + const void **ppPattern; + size_t *ppatternSize; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_usm_fill_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferCopyExp +/// @brief Function parameters for urCommandBufferAppendMemBufferCopyExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_membuffer_copy_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_copy_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phSrcMem; ur_mem_handle_t *phDstMem; @@ -9945,13 +10037,13 @@ typedef struct ur_command_buffer_append_membuffer_copy_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_membuffer_copy_exp_params_t; +} ur_command_buffer_append_mem_buffer_copy_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferWriteExp +/// @brief Function parameters for urCommandBufferAppendMemBufferWriteExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_membuffer_write_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_write_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; size_t *poffset; @@ -9960,13 +10052,13 @@ typedef struct ur_command_buffer_append_membuffer_write_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_membuffer_write_exp_params_t; +} ur_command_buffer_append_mem_buffer_write_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferReadExp +/// @brief Function parameters for urCommandBufferAppendMemBufferReadExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_membuffer_read_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_read_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; size_t *poffset; @@ -9975,13 +10067,13 @@ typedef struct ur_command_buffer_append_membuffer_read_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_membuffer_read_exp_params_t; +} ur_command_buffer_append_mem_buffer_read_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferCopyRectExp +/// @brief Function parameters for urCommandBufferAppendMemBufferCopyRectExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phSrcMem; ur_mem_handle_t *phDstMem; @@ -9995,13 +10087,13 @@ typedef struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_membuffer_copy_rect_exp_params_t; +} ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferWriteRectExp +/// @brief Function parameters for urCommandBufferAppendMemBufferWriteRectExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_membuffer_write_rect_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; ur_rect_offset_t *pbufferOffset; @@ -10015,13 +10107,13 @@ typedef struct ur_command_buffer_append_membuffer_write_rect_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_membuffer_write_rect_exp_params_t; +} ur_command_buffer_append_mem_buffer_write_rect_exp_params_t; /////////////////////////////////////////////////////////////////////////////// -/// @brief Function parameters for urCommandBufferAppendMembufferReadRectExp +/// @brief Function parameters for urCommandBufferAppendMemBufferReadRectExp /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value -typedef struct ur_command_buffer_append_membuffer_read_rect_exp_params_t { +typedef struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; ur_mem_handle_t *phBuffer; ur_rect_offset_t *pbufferOffset; @@ -10035,7 +10127,23 @@ typedef struct ur_command_buffer_append_membuffer_read_rect_exp_params_t { uint32_t *pnumSyncPointsInWaitList; const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; -} ur_command_buffer_append_membuffer_read_rect_exp_params_t; +} ur_command_buffer_append_mem_buffer_read_rect_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendMemBufferFillExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_mem_buffer_fill_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + ur_mem_handle_t *phBuffer; + const void **ppPattern; + size_t *ppatternSize; + size_t *poffset; + size_t *psize; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_mem_buffer_fill_exp_params_t; /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urCommandBufferEnqueueExp diff --git a/include/ur_ddi.h b/include/ur_ddi.h index cd6e9f77d9..ff3bfca155 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1727,8 +1727,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendKernelLaunchExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMemcpyUSMExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemcpyUSMExp_t)( +/// @brief Function-pointer for urCommandBufferAppendUSMMemcpyExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMMemcpyExp_t)( ur_exp_command_buffer_handle_t, void *, const void *, @@ -1738,8 +1738,20 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemcpyUSMExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferCopyExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyExp_t)( +/// @brief Function-pointer for urCommandBufferAppendUSMFillExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMFillExp_t)( + ur_exp_command_buffer_handle_t, + void *, + const void *, + size_t, + size_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, @@ -1751,8 +1763,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferWriteExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteExp_t)( +/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, @@ -1763,8 +1775,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferReadExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadExp_t)( +/// @brief Function-pointer for urCommandBufferAppendMemBufferReadExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, @@ -1775,8 +1787,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadExp_t)( ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferCopyRectExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyRectExp_t)( +/// @brief Function-pointer for urCommandBufferAppendMemBufferCopyRectExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferCopyRectExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, @@ -1792,8 +1804,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferCopyRectExp_t) ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferWriteRectExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteRectExp_t)( +/// @brief Function-pointer for urCommandBufferAppendMemBufferWriteRectExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferWriteRectExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, @@ -1809,8 +1821,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferWriteRectExp_t ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// -/// @brief Function-pointer for urCommandBufferAppendMembufferReadRectExp -typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadRectExp_t)( +/// @brief Function-pointer for urCommandBufferAppendMemBufferReadRectExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferReadRectExp_t)( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, @@ -1825,6 +1837,19 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMembufferReadRectExp_t) const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendMemBufferFillExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( + ur_exp_command_buffer_handle_t, + ur_mem_handle_t, + const void *, + size_t, + size_t, + size_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferEnqueueExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)( @@ -1842,13 +1867,15 @@ typedef struct ur_command_buffer_exp_dditable_t { ur_pfnCommandBufferReleaseExp_t pfnReleaseExp; ur_pfnCommandBufferFinalizeExp_t pfnFinalizeExp; ur_pfnCommandBufferAppendKernelLaunchExp_t pfnAppendKernelLaunchExp; - ur_pfnCommandBufferAppendMemcpyUSMExp_t pfnAppendMemcpyUSMExp; - ur_pfnCommandBufferAppendMembufferCopyExp_t pfnAppendMembufferCopyExp; - ur_pfnCommandBufferAppendMembufferWriteExp_t pfnAppendMembufferWriteExp; - ur_pfnCommandBufferAppendMembufferReadExp_t pfnAppendMembufferReadExp; - ur_pfnCommandBufferAppendMembufferCopyRectExp_t pfnAppendMembufferCopyRectExp; - ur_pfnCommandBufferAppendMembufferWriteRectExp_t pfnAppendMembufferWriteRectExp; - ur_pfnCommandBufferAppendMembufferReadRectExp_t pfnAppendMembufferReadRectExp; + ur_pfnCommandBufferAppendUSMMemcpyExp_t pfnAppendUSMMemcpyExp; + ur_pfnCommandBufferAppendUSMFillExp_t pfnAppendUSMFillExp; + ur_pfnCommandBufferAppendMemBufferCopyExp_t pfnAppendMemBufferCopyExp; + ur_pfnCommandBufferAppendMemBufferWriteExp_t pfnAppendMemBufferWriteExp; + ur_pfnCommandBufferAppendMemBufferReadExp_t pfnAppendMemBufferReadExp; + ur_pfnCommandBufferAppendMemBufferCopyRectExp_t pfnAppendMemBufferCopyRectExp; + ur_pfnCommandBufferAppendMemBufferWriteRectExp_t pfnAppendMemBufferWriteRectExp; + ur_pfnCommandBufferAppendMemBufferReadRectExp_t pfnAppendMemBufferReadRectExp; + ur_pfnCommandBufferAppendMemBufferFillExp_t pfnAppendMemBufferFillExp; ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp; } ur_command_buffer_exp_dditable_t; diff --git a/scripts/core/EXP-COMMAND-BUFFER.rst b/scripts/core/EXP-COMMAND-BUFFER.rst index a169117022..9617044432 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -92,13 +92,15 @@ of event handles. Currently only the following commands are supported: * ${x}CommandBufferAppendKernelLaunchExp -* ${x}CommandBufferAppendMemcpyUSMExp -* ${x}CommandBufferAppendMembufferCopyExp -* ${x}CommandBufferAppendMembufferCopyRectExp -* ${x}CommandBufferAppendMembufferReadExp -* ${x}CommandBufferAppendMembufferReadRectExp -* ${x}CommandBufferAppendMembufferWriteExp -* ${x}CommandBufferAppendMembufferWriteRectExp +* ${x}CommandBufferAppendUSMMemcpyExp +* ${x}CommandBufferAppendUSMFillExp +* ${x}CommandBufferAppendMemBufferCopyExp +* ${x}CommandBufferAppendMemBufferCopyRectExp +* ${x}CommandBufferAppendMemBufferReadExp +* ${x}CommandBufferAppendMemBufferReadRectExp +* ${x}CommandBufferAppendMemBufferWriteExp +* ${x}CommandBufferAppendMemBufferWriteRectExp +* ${x}CommandBufferAppendMemBufferFillExp It is planned to eventually support any command type from the Core API which can actually be appended to the equiavalent adapter native constructs. @@ -118,7 +120,7 @@ were obtained from. // Append a memcpy with no sync-point dependencies ${x}_exp_command_buffer_sync_point_t syncPoint; - ${x}CommandBufferAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, 0, + ${x}CommandBufferAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, 0, nullptr, &syncPoint); // Append a kernel launch with syncPoint as a dependency, ignore returned @@ -167,13 +169,15 @@ Enums * ${X}_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP * ${X}_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP - * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP @@ -191,13 +195,15 @@ Functions * ${x}CommandBufferReleaseExp * ${x}CommandBufferFinalizeExp * ${x}CommandBufferAppendKernelLaunchExp -* ${x}CommandBufferAppendMemcpyUSMExp -* ${x}CommandBufferAppendMembufferCopyExp -* ${x}CommandBufferAppendMembufferCopyRectExp -* ${x}CommandBufferAppendMembufferReadExp -* ${x}CommandBufferAppendMembufferReadRectExp -* ${x}CommandBufferAppendMembufferWriteExp -* ${x}CommandBufferAppendMembufferWriteRectExp +* ${x}CommandBufferAppendUSMMemcpyExp +* ${x}CommandBufferAppendUSMFillExp +* ${x}CommandBufferAppendMemBufferCopyExp +* ${x}CommandBufferAppendMemBufferCopyRectExp +* ${x}CommandBufferAppendMemBufferReadExp +* ${x}CommandBufferAppendMemBufferReadRectExp +* ${x}CommandBufferAppendMemBufferWriteExp +* ${x}CommandBufferAppendMemBufferWriteRectExp +* ${x}CommandBufferAppendMemBufferFillExp * ${x}CommandBufferEnqueueExp Changelog @@ -208,7 +214,9 @@ Changelog +===========+=======================================================+ | 1.0 | Initial Draft | +-----------+-------------------------------------------------------+ -| 1.1 | add function definitions for buffer read and write | +| 1.1 | Add function definitions for buffer read and write | ++-----------+-------------------------------------------------------+ +| 1.2 | Add function definitions for fill commands | +-----------+-------------------------------------------------------+ Contributors diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index e8c5417831..691bf56b86 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -180,7 +180,7 @@ returns: type: function desc: "Append a USM memcpy command to a command-buffer object" class: $xCommandBuffer -name: AppendMemcpyUSMExp +name: AppendUSMMemcpyExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -217,9 +217,54 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a USM fill command to a command-buffer object" +class: $xCommandBuffer +name: AppendUSMFillExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: "void*" + name: pMemory + desc: "[in] pointer to USM allocated memory to fill." + - type: "const void*" + name: pPattern + desc: "[in] pointer to the fill pattern." + - type: "size_t" + name: patternSize + desc: "[in] size in bytes of the pattern." + - type: "size_t" + name: size + desc: "[in] fill size in bytes, must be a multiple of patternSize." + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." + - type: "$x_exp_command_buffer_sync_point_t*" + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_SIZE: + - "`patternSize == 0 || size == 0`" + - "`patternSize > size`" + - "`(patternSize & (patternSize - 1)) != 0`" + - "`size % patternSize != 0`" + - "If `size` is higher than the allocation size of `ptr`" + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function desc: "Append a memory copy command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferCopyExp +name: AppendMemBufferCopyExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -261,7 +306,7 @@ returns: type: function desc: "Append a memory write command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferWriteExp +name: AppendMemBufferWriteExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -300,7 +345,7 @@ returns: type: function desc: "Append a memory read command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferReadExp +name: AppendMemBufferReadExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -339,7 +384,7 @@ returns: type: function desc: "Append a rectangular memory copy command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferCopyRectExp +name: AppendMemBufferCopyRectExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -393,7 +438,7 @@ returns: type: function desc: "Append a rectangular memory write command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferWriteRectExp +name: AppendMemBufferWriteRectExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -447,7 +492,7 @@ returns: type: function desc: "Append a rectangular memory read command to a command-buffer object" class: $xCommandBuffer -name: AppendMembufferReadRectExp +name: AppendMemBufferReadRectExp params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer @@ -499,6 +544,50 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a memory fill command to a command-buffer object" +class: $xCommandBuffer +name: AppendMemBufferFillExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: $x_mem_handle_t + name: hBuffer + desc: "[in] handle of the buffer object." + - type: "const void*" + name: pPattern + desc: "[in] pointer to the fill pattern." + - type: "size_t" + name: patternSize + desc: "[in] size in bytes of the pattern." + - type: "size_t" + name: offset + desc: "[in] offset into the buffer." + - type: "size_t" + name: size + desc: "[in] fill size in bytes, must be a multiple of patternSize." + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." + - type: $x_exp_command_buffer_sync_point_t* + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "If `offset + size` results in an out-of-bounds access." + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function desc: "Submit a command-buffer for execution on a queue." class: $xCommandBuffer name: EnqueueExp diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 435e7d8eda..01b4b50334 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -367,15 +367,6 @@ etors: - name: COMMAND_BUFFER_ENQUEUE_EXP desc: Enumerator for $xCommandBufferEnqueueExp value: '128' -- name: COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP - desc: Enumerator for $xCommandBufferAppendMemcpyUSMExp - value: '129' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP - desc: Enumerator for $xCommandBufferAppendMembufferCopyExp - value: '130' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP - desc: Enumerator for $xCommandBufferAppendMembufferCopyRectExp - value: '131' - name: USM_PITCHED_ALLOC_EXP desc: Enumerator for $xUSMPitchedAllocExp value: '132' @@ -481,18 +472,6 @@ etors: - name: USM_P2P_PEER_ACCESS_GET_INFO_EXP desc: Enumerator for $xUsmP2PPeerAccessGetInfoExp value: '167' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP - desc: Enumerator for $xCommandBufferAppendMembufferWriteExp - value: '168' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP - desc: Enumerator for $xCommandBufferAppendMembufferReadExp - value: '169' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP - desc: Enumerator for $xCommandBufferAppendMembufferWriteRectExp - value: '170' -- name: COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP - desc: Enumerator for $xCommandBufferAppendMembufferReadRectExp - value: '171' - name: LOADER_CONFIG_CREATE desc: Enumerator for $xLoaderConfigCreate value: '172' @@ -529,6 +508,33 @@ etors: - name: LOADER_TEAR_DOWN desc: Enumerator for $xLoaderTearDown value: '183' +- name: COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP + desc: Enumerator for $xCommandBufferAppendUSMMemcpyExp + value: '184' +- name: COMMAND_BUFFER_APPEND_USM_FILL_EXP + desc: Enumerator for $xCommandBufferAppendUSMFillExp + value: '185' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferCopyExp + value: '186' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferWriteExp + value: '187' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferReadExp + value: '188' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferCopyRectExp + value: '189' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferWriteRectExp + value: '190' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferReadRectExp + value: '191' +- name: COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP + desc: Enumerator for $xCommandBufferAppendMemBufferFillExp + value: '192' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index e5efe2b49c..29d2faef98 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4545,8 +4545,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -4562,10 +4562,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMemcpyUSMExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; - if (nullptr != pfnAppendMemcpyUSMExp) { - result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + auto pfnAppendUSMMemcpyExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; + if (nullptr != pfnAppendUSMMemcpyExp) { + result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4578,8 +4578,43 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendUSMFillExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + if (nullptr != pfnAppendUSMFillExp) { + result = pfnAppendUSMFillExp(hCommandBuffer, pMemory, pPattern, + patternSize, size, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -4597,10 +4632,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMembufferCopyExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; - if (nullptr != pfnAppendMembufferCopyExp) { - result = pfnAppendMembufferCopyExp( + auto pfnAppendMemBufferCopyExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; + if (nullptr != pfnAppendMemBufferCopyExp) { + result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4613,8 +4648,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -4632,10 +4667,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMembufferWriteExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; - if (nullptr != pfnAppendMembufferWriteExp) { - result = pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, + auto pfnAppendMemBufferWriteExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; + if (nullptr != pfnAppendMemBufferWriteExp) { + result = pfnAppendMemBufferWriteExp(hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4648,8 +4683,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -4666,10 +4701,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMembufferReadExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; - if (nullptr != pfnAppendMembufferReadExp) { - result = pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, + auto pfnAppendMemBufferReadExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; + if (nullptr != pfnAppendMemBufferReadExp) { + result = pfnAppendMemBufferReadExp(hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } else { @@ -4682,8 +4717,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -4708,10 +4743,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMembufferCopyRectExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyRectExp; - if (nullptr != pfnAppendMembufferCopyRectExp) { - result = pfnAppendMembufferCopyRectExp( + auto pfnAppendMemBufferCopyRectExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyRectExp; + if (nullptr != pfnAppendMemBufferCopyRectExp) { + result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -4725,8 +4760,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -4757,10 +4792,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMembufferWriteRectExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; - if (nullptr != pfnAppendMembufferWriteRectExp) { - result = pfnAppendMembufferWriteRectExp( + auto pfnAppendMemBufferWriteRectExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteRectExp; + if (nullptr != pfnAppendMemBufferWriteRectExp) { + result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -4774,8 +4809,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -4804,10 +4839,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_result_t result = UR_RESULT_SUCCESS; // if the driver has created a custom function, then call it instead of using the generic path - auto pfnAppendMembufferReadRectExp = - d_context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; - if (nullptr != pfnAppendMembufferReadRectExp) { - result = pfnAppendMembufferReadRectExp( + auto pfnAppendMemBufferReadRectExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadRectExp; + if (nullptr != pfnAppendMemBufferReadRectExp) { + result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -4820,6 +4855,42 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendMemBufferFillExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + if (nullptr != pfnAppendMemBufferFillExp) { + result = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -5129,26 +5200,31 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendKernelLaunchExp = driver::urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = - driver::urCommandBufferAppendMemcpyUSMExp; + pDdiTable->pfnAppendUSMMemcpyExp = + driver::urCommandBufferAppendUSMMemcpyExp; + + pDdiTable->pfnAppendUSMFillExp = driver::urCommandBufferAppendUSMFillExp; + + pDdiTable->pfnAppendMemBufferCopyExp = + driver::urCommandBufferAppendMemBufferCopyExp; - pDdiTable->pfnAppendMembufferCopyExp = - driver::urCommandBufferAppendMembufferCopyExp; + pDdiTable->pfnAppendMemBufferWriteExp = + driver::urCommandBufferAppendMemBufferWriteExp; - pDdiTable->pfnAppendMembufferWriteExp = - driver::urCommandBufferAppendMembufferWriteExp; + pDdiTable->pfnAppendMemBufferReadExp = + driver::urCommandBufferAppendMemBufferReadExp; - pDdiTable->pfnAppendMembufferReadExp = - driver::urCommandBufferAppendMembufferReadExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + driver::urCommandBufferAppendMemBufferCopyRectExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - driver::urCommandBufferAppendMembufferCopyRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + driver::urCommandBufferAppendMemBufferWriteRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - driver::urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + driver::urCommandBufferAppendMemBufferReadRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - driver::urCommandBufferAppendMembufferReadRectExp; + pDdiTable->pfnAppendMemBufferFillExp = + driver::urCommandBufferAppendMemBufferFillExp; pDdiTable->pfnEnqueueExp = driver::urCommandBufferEnqueueExp; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 0fe2ebc9f8..3ee474d105 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -925,18 +925,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { os << "UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP"; - break; - case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: os << "UR_FUNCTION_USM_PITCHED_ALLOC_EXP"; break; @@ -1078,22 +1066,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { os << "UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP"; - break; - - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP: - os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP"; - break; - case UR_FUNCTION_LOADER_CONFIG_CREATE: os << "UR_FUNCTION_LOADER_CONFIG_CREATE"; break; @@ -1141,6 +1113,42 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_LOADER_TEAR_DOWN: os << "UR_FUNCTION_LOADER_TEAR_DOWN"; break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP"; + break; default: os << "unknown enumerator"; break; @@ -10731,7 +10739,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_memcpy_usm_exp_params_t *params) { + const struct ur_command_buffer_append_usm_memcpy_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10772,7 +10780,54 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_copy_exp_params_t *params) { + const struct ur_command_buffer_append_usm_fill_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur_params::serializePtr(os, *(params->ppMemory)); + + os << ", "; + os << ".pPattern = "; + + ur_params::serializePtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".pSyncPoint = "; + + ur_params::serializePtr(os, *(params->ppSyncPoint)); + + return os; +} + +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_command_buffer_append_mem_buffer_copy_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10823,7 +10878,7 @@ inline std::ostream &operator<<( inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_append_membuffer_write_exp_params_t + const struct ur_command_buffer_append_mem_buffer_write_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10868,9 +10923,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_membuffer_read_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_command_buffer_append_mem_buffer_read_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10916,7 +10972,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_copy_rect_exp_params_t + const struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10988,7 +11044,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_write_rect_exp_params_t + const struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11060,7 +11116,7 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_membuffer_read_rect_exp_params_t + const struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11130,6 +11186,58 @@ inline std::ostream &operator<<( return os; } +inline std::ostream & +operator<<(std::ostream &os, + const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t + *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".hBuffer = "; + + ur_params::serializePtr(os, *(params->phBuffer)); + + os << ", "; + os << ".pPattern = "; + + ur_params::serializePtr(os, *(params->ppPattern)); + + os << ", "; + os << ".patternSize = "; + + os << *(params->ppatternSize); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".pSyncPoint = "; + + ur_params::serializePtr(os, *(params->ppSyncPoint)); + + return os; +} + inline std::ostream & operator<<(std::ostream &os, const struct ur_command_buffer_enqueue_exp_params_t *params) { @@ -15433,37 +15541,45 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_command_buffer_append_kernel_launch_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP: { - os << (const struct ur_command_buffer_append_memcpy_usm_exp_params_t *) + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: { + os << (const struct ur_command_buffer_append_usm_memcpy_exp_params_t *) params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP: { - os << (const struct ur_command_buffer_append_membuffer_copy_exp_params_t - *)params; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: { + os << (const struct ur_command_buffer_append_usm_fill_exp_params_t *) + params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: { os << (const struct - ur_command_buffer_append_membuffer_write_exp_params_t *)params; + ur_command_buffer_append_mem_buffer_copy_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP: { - os << (const struct ur_command_buffer_append_membuffer_read_exp_params_t - *)params; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_write_exp_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: { os << (const struct - ur_command_buffer_append_membuffer_copy_rect_exp_params_t *) + ur_command_buffer_append_mem_buffer_read_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *) params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: { os << (const struct - ur_command_buffer_append_membuffer_write_rect_exp_params_t *) + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *) params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP: { + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: { os << (const struct - ur_command_buffer_append_membuffer_read_rect_exp_params_t *) + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *) params; } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: { + os << (const struct + ur_command_buffer_append_mem_buffer_fill_exp_params_t *)params; + } break; case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: { os << (const struct ur_command_buffer_enqueue_exp_params_t *)params; } break; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 3f79c3aa13..dee41bc1c1 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5184,8 +5184,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -5198,34 +5198,77 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMemcpyUSMExp = - context.urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; + auto pfnAppendUSMMemcpyExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_memcpy_usm_exp_params_t params = { + ur_command_buffer_append_usm_memcpy_exp_params_t params = { &hCommandBuffer, &pDst, &pSrc, &size, &numSyncPointsInWaitList, &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = - context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP, - "urCommandBufferAppendMemcpyUSMExp", ¶ms); + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, + "urCommandBufferAppendUSMMemcpyExp", ¶ms); - ur_result_t result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + ur_result_t result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); - context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMCPY_USM_EXP, - "urCommandBufferAppendMemcpyUSMExp", ¶ms, &result, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP, + "urCommandBufferAppendUSMMemcpyExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_usm_fill_exp_params_t params = { + &hCommandBuffer, &pMemory, &pPattern, + &patternSize, &size, &numSyncPointsInWaitList, + &pSyncPointWaitList, &pSyncPoint}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, + "urCommandBufferAppendUSMFillExp", ¶ms); + + ur_result_t result = pfnAppendUSMFillExp( + hCommandBuffer, pMemory, pPattern, patternSize, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP, + "urCommandBufferAppendUSMFillExp", ¶ms, &result, + instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -5240,14 +5283,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; + auto pfnAppendMemBufferCopyExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_copy_exp_params_t params = { + ur_command_buffer_append_mem_buffer_copy_exp_params_t params = { &hCommandBuffer, &hSrcMem, &hDstMem, @@ -5258,23 +5301,23 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP, - "urCommandBufferAppendMembufferCopyExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, + "urCommandBufferAppendMemBufferCopyExp", ¶ms); - ur_result_t result = pfnAppendMembufferCopyExp( + ur_result_t result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); - context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_EXP, - "urCommandBufferAppendMembufferCopyExp", ¶ms, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP, + "urCommandBufferAppendMemBufferCopyExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -5289,14 +5332,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + auto pfnAppendMemBufferWriteExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_write_exp_params_t params = { + ur_command_buffer_append_mem_buffer_write_exp_params_t params = { &hCommandBuffer, &hBuffer, &offset, @@ -5306,23 +5349,23 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP, - "urCommandBufferAppendMembufferWriteExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, + "urCommandBufferAppendMemBufferWriteExp", ¶ms); - ur_result_t result = pfnAppendMembufferWriteExp( + ur_result_t result = pfnAppendMemBufferWriteExp( hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); - context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_EXP, - "urCommandBufferAppendMembufferWriteExp", ¶ms, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP, + "urCommandBufferAppendMemBufferWriteExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -5336,14 +5379,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + auto pfnAppendMemBufferReadExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_read_exp_params_t params = { + ur_command_buffer_append_mem_buffer_read_exp_params_t params = { &hCommandBuffer, &hBuffer, &offset, @@ -5353,23 +5396,23 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP, - "urCommandBufferAppendMembufferReadExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, + "urCommandBufferAppendMemBufferReadExp", ¶ms); - ur_result_t result = pfnAppendMembufferReadExp( + ur_result_t result = pfnAppendMemBufferReadExp( hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); - context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_EXP, - "urCommandBufferAppendMembufferReadExp", ¶ms, + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP, + "urCommandBufferAppendMemBufferReadExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -5391,14 +5434,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyRectExp; + auto pfnAppendMemBufferCopyRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_copy_rect_exp_params_t params = { + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t params = { &hCommandBuffer, &hSrcMem, &hDstMem, @@ -5413,25 +5456,25 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP, - "urCommandBufferAppendMembufferCopyRectExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, + "urCommandBufferAppendMemBufferCopyRectExp", ¶ms); - ur_result_t result = pfnAppendMembufferCopyRectExp( + ur_result_t result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); context.notify_end( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_COPY_RECT_EXP, - "urCommandBufferAppendMembufferCopyRectExp", ¶ms, &result, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP, + "urCommandBufferAppendMemBufferCopyRectExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -5459,14 +5502,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + auto pfnAppendMemBufferWriteRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_write_rect_exp_params_t params = { + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t params = { &hCommandBuffer, &hBuffer, &bufferOffset, @@ -5481,25 +5524,25 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP, - "urCommandBufferAppendMembufferWriteRectExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, + "urCommandBufferAppendMemBufferWriteRectExp", ¶ms); - ur_result_t result = pfnAppendMembufferWriteRectExp( + ur_result_t result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); context.notify_end( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_WRITE_RECT_EXP, - "urCommandBufferAppendMembufferWriteRectExp", ¶ms, &result, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP, + "urCommandBufferAppendMemBufferWriteRectExp", ¶ms, &result, instance); return result; } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -5525,14 +5568,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + auto pfnAppendMemBufferReadRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } - ur_command_buffer_append_membuffer_read_rect_exp_params_t params = { + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t params = { &hCommandBuffer, &hBuffer, &bufferOffset, @@ -5547,22 +5590,72 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( &pSyncPointWaitList, &pSyncPoint}; uint64_t instance = context.notify_begin( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP, - "urCommandBufferAppendMembufferReadRectExp", ¶ms); + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, + "urCommandBufferAppendMemBufferReadRectExp", ¶ms); - ur_result_t result = pfnAppendMembufferReadRectExp( + ur_result_t result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); context.notify_end( - UR_FUNCTION_COMMAND_BUFFER_APPEND_MEMBUFFER_READ_RECT_EXP, - "urCommandBufferAppendMembufferReadRectExp", ¶ms, &result, + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP, + "urCommandBufferAppendMemBufferReadRectExp", ¶ms, &result, instance); return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendMemBufferFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_mem_buffer_fill_exp_params_t params = { + &hCommandBuffer, + &hBuffer, + &pPattern, + &patternSize, + &offset, + &size, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, + "urCommandBufferAppendMemBufferFillExp", ¶ms); + + ur_result_t result = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP, + "urCommandBufferAppendMemBufferFillExp", ¶ms, + &result, instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -5943,36 +6036,44 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendKernelLaunchExp = ur_tracing_layer::urCommandBufferAppendKernelLaunchExp; - dditable.pfnAppendMemcpyUSMExp = pDdiTable->pfnAppendMemcpyUSMExp; - pDdiTable->pfnAppendMemcpyUSMExp = - ur_tracing_layer::urCommandBufferAppendMemcpyUSMExp; + dditable.pfnAppendUSMMemcpyExp = pDdiTable->pfnAppendUSMMemcpyExp; + pDdiTable->pfnAppendUSMMemcpyExp = + ur_tracing_layer::urCommandBufferAppendUSMMemcpyExp; + + dditable.pfnAppendUSMFillExp = pDdiTable->pfnAppendUSMFillExp; + pDdiTable->pfnAppendUSMFillExp = + ur_tracing_layer::urCommandBufferAppendUSMFillExp; + + dditable.pfnAppendMemBufferCopyExp = pDdiTable->pfnAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyExp = + ur_tracing_layer::urCommandBufferAppendMemBufferCopyExp; - dditable.pfnAppendMembufferCopyExp = pDdiTable->pfnAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyExp = - ur_tracing_layer::urCommandBufferAppendMembufferCopyExp; + dditable.pfnAppendMemBufferWriteExp = pDdiTable->pfnAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteExp = + ur_tracing_layer::urCommandBufferAppendMemBufferWriteExp; - dditable.pfnAppendMembufferWriteExp = pDdiTable->pfnAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteExp = - ur_tracing_layer::urCommandBufferAppendMembufferWriteExp; + dditable.pfnAppendMemBufferReadExp = pDdiTable->pfnAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadExp = + ur_tracing_layer::urCommandBufferAppendMemBufferReadExp; - dditable.pfnAppendMembufferReadExp = pDdiTable->pfnAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadExp = - ur_tracing_layer::urCommandBufferAppendMembufferReadExp; + dditable.pfnAppendMemBufferCopyRectExp = + pDdiTable->pfnAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + ur_tracing_layer::urCommandBufferAppendMemBufferCopyRectExp; - dditable.pfnAppendMembufferCopyRectExp = - pDdiTable->pfnAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - ur_tracing_layer::urCommandBufferAppendMembufferCopyRectExp; + dditable.pfnAppendMemBufferWriteRectExp = + pDdiTable->pfnAppendMemBufferWriteRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + ur_tracing_layer::urCommandBufferAppendMemBufferWriteRectExp; - dditable.pfnAppendMembufferWriteRectExp = - pDdiTable->pfnAppendMembufferWriteRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - ur_tracing_layer::urCommandBufferAppendMembufferWriteRectExp; + dditable.pfnAppendMemBufferReadRectExp = + pDdiTable->pfnAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + ur_tracing_layer::urCommandBufferAppendMemBufferReadRectExp; - dditable.pfnAppendMembufferReadRectExp = - pDdiTable->pfnAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - ur_tracing_layer::urCommandBufferAppendMembufferReadRectExp; + dditable.pfnAppendMemBufferFillExp = pDdiTable->pfnAppendMemBufferFillExp; + pDdiTable->pfnAppendMemBufferFillExp = + ur_tracing_layer::urCommandBufferAppendMemBufferFillExp; dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_tracing_layer::urCommandBufferEnqueueExp; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 08cf04c672..efcc2cd9c3 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -6481,8 +6481,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -6495,10 +6495,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMemcpyUSMExp = - context.urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; + auto pfnAppendUSMMemcpyExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6528,7 +6528,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } } - ur_result_t result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + ur_result_t result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6536,8 +6536,77 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pMemory) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (NULL == pPattern) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (patternSize == 0 || size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (patternSize > size) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if ((patternSize & (patternSize - 1)) != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (size % patternSize != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + } + + ur_result_t result = pfnAppendUSMFillExp( + hCommandBuffer, pMemory, pPattern, patternSize, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6552,10 +6621,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; + auto pfnAppendMemBufferCopyExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6581,7 +6650,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } } - ur_result_t result = pfnAppendMembufferCopyExp( + ur_result_t result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6589,8 +6658,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6605,10 +6674,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; + auto pfnAppendMemBufferWriteExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6634,7 +6703,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } } - ur_result_t result = pfnAppendMembufferWriteExp( + ur_result_t result = pfnAppendMemBufferWriteExp( hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6642,8 +6711,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6657,10 +6726,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; + auto pfnAppendMemBufferReadExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6686,7 +6755,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } } - ur_result_t result = pfnAppendMembufferReadExp( + ur_result_t result = pfnAppendMemBufferReadExp( hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6694,8 +6763,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6717,10 +6786,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferCopyRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferCopyRectExp; + auto pfnAppendMemBufferCopyRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6746,7 +6815,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } } - ur_result_t result = pfnAppendMembufferCopyRectExp( + ur_result_t result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6755,8 +6824,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6784,10 +6853,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferWriteRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferWriteRectExp; + auto pfnAppendMemBufferWriteRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6813,7 +6882,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } } - ur_result_t result = pfnAppendMembufferWriteRectExp( + ur_result_t result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6822,8 +6891,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6849,10 +6918,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) { - auto pfnAppendMembufferReadRectExp = - context.urDdiTable.CommandBufferExp.pfnAppendMembufferReadRectExp; + auto pfnAppendMemBufferReadRectExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6878,7 +6947,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( } } - ur_result_t result = pfnAppendMembufferReadRectExp( + ur_result_t result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6886,6 +6955,60 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendMemBufferFillExp = + context.urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pPattern) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + } + + ur_result_t result = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7304,36 +7427,44 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendKernelLaunchExp = ur_validation_layer::urCommandBufferAppendKernelLaunchExp; - dditable.pfnAppendMemcpyUSMExp = pDdiTable->pfnAppendMemcpyUSMExp; - pDdiTable->pfnAppendMemcpyUSMExp = - ur_validation_layer::urCommandBufferAppendMemcpyUSMExp; + dditable.pfnAppendUSMMemcpyExp = pDdiTable->pfnAppendUSMMemcpyExp; + pDdiTable->pfnAppendUSMMemcpyExp = + ur_validation_layer::urCommandBufferAppendUSMMemcpyExp; + + dditable.pfnAppendUSMFillExp = pDdiTable->pfnAppendUSMFillExp; + pDdiTable->pfnAppendUSMFillExp = + ur_validation_layer::urCommandBufferAppendUSMFillExp; + + dditable.pfnAppendMemBufferCopyExp = pDdiTable->pfnAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyExp = + ur_validation_layer::urCommandBufferAppendMemBufferCopyExp; - dditable.pfnAppendMembufferCopyExp = pDdiTable->pfnAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyExp = - ur_validation_layer::urCommandBufferAppendMembufferCopyExp; + dditable.pfnAppendMemBufferWriteExp = pDdiTable->pfnAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteExp = + ur_validation_layer::urCommandBufferAppendMemBufferWriteExp; - dditable.pfnAppendMembufferWriteExp = pDdiTable->pfnAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteExp = - ur_validation_layer::urCommandBufferAppendMembufferWriteExp; + dditable.pfnAppendMemBufferReadExp = pDdiTable->pfnAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadExp = + ur_validation_layer::urCommandBufferAppendMemBufferReadExp; - dditable.pfnAppendMembufferReadExp = pDdiTable->pfnAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadExp = - ur_validation_layer::urCommandBufferAppendMembufferReadExp; + dditable.pfnAppendMemBufferCopyRectExp = + pDdiTable->pfnAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + ur_validation_layer::urCommandBufferAppendMemBufferCopyRectExp; - dditable.pfnAppendMembufferCopyRectExp = - pDdiTable->pfnAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - ur_validation_layer::urCommandBufferAppendMembufferCopyRectExp; + dditable.pfnAppendMemBufferWriteRectExp = + pDdiTable->pfnAppendMemBufferWriteRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + ur_validation_layer::urCommandBufferAppendMemBufferWriteRectExp; - dditable.pfnAppendMembufferWriteRectExp = - pDdiTable->pfnAppendMembufferWriteRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - ur_validation_layer::urCommandBufferAppendMembufferWriteRectExp; + dditable.pfnAppendMemBufferReadRectExp = + pDdiTable->pfnAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + ur_validation_layer::urCommandBufferAppendMemBufferReadRectExp; - dditable.pfnAppendMembufferReadRectExp = - pDdiTable->pfnAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - ur_validation_layer::urCommandBufferAppendMembufferReadRectExp; + dditable.pfnAppendMemBufferFillExp = pDdiTable->pfnAppendMemBufferFillExp; + pDdiTable->pfnAppendMemBufferFillExp = + ur_validation_layer::urCommandBufferAppendMemBufferFillExp; dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_validation_layer::urCommandBufferEnqueueExp; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index ce615c9945..7776758069 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6345,8 +6345,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMemcpyUSMExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +/// @brief Intercept function for urCommandBufferAppendUSMMemcpyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -6365,9 +6365,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMemcpyUSMExp = - dditable->ur.CommandBufferExp.pfnAppendMemcpyUSMExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + auto pfnAppendUSMMemcpyExp = + dditable->ur.CommandBufferExp.pfnAppendUSMMemcpyExp; + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6377,7 +6377,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ->handle; // forward to device-platform - result = pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + result = pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6385,8 +6385,50 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +/// @brief Intercept function for urCommandBufferAppendUSMFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = + reinterpret_cast(hCommandBuffer) + ->dditable; + auto pfnAppendUSMFillExp = + dditable->ur.CommandBufferExp.pfnAppendUSMFillExp; + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // forward to device-platform + result = pfnAppendUSMFillExp(hCommandBuffer, pMemory, pPattern, patternSize, + size, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6407,9 +6449,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferCopyExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + auto pfnAppendMemBufferCopyExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferCopyExp; + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6425,7 +6467,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( hDstMem = reinterpret_cast(hDstMem)->handle; // forward to device-platform - result = pfnAppendMembufferCopyExp( + result = pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6433,8 +6475,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6455,9 +6497,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferWriteExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + auto pfnAppendMemBufferWriteExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferWriteExp; + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6470,7 +6512,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, size, + result = pfnAppendMemBufferWriteExp(hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6478,8 +6520,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6499,9 +6541,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferReadExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + auto pfnAppendMemBufferReadExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferReadExp; + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6514,7 +6556,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, size, + result = pfnAppendMemBufferReadExp(hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6522,8 +6564,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferCopyRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferCopyRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6551,9 +6593,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferCopyRectExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + auto pfnAppendMemBufferCopyRectExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferCopyRectExp; + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6569,7 +6611,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( hDstMem = reinterpret_cast(hDstMem)->handle; // forward to device-platform - result = pfnAppendMembufferCopyRectExp( + result = pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6578,8 +6620,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferWriteRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferWriteRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6613,9 +6655,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferWriteRectExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + auto pfnAppendMemBufferWriteRectExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferWriteRectExp; + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6628,7 +6670,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferWriteRectExp( + result = pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6637,8 +6679,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } /////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urCommandBufferAppendMembufferReadRectExp -__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +/// @brief Intercept function for urCommandBufferAppendMemBufferReadRectExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6670,9 +6712,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( auto dditable = reinterpret_cast(hCommandBuffer) ->dditable; - auto pfnAppendMembufferReadRectExp = - dditable->ur.CommandBufferExp.pfnAppendMembufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + auto pfnAppendMemBufferReadRectExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferReadRectExp; + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } @@ -6685,7 +6727,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( hBuffer = reinterpret_cast(hBuffer)->handle; // forward to device-platform - result = pfnAppendMembufferReadRectExp( + result = pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -6693,6 +6735,52 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendMemBufferFillExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = + reinterpret_cast(hCommandBuffer) + ->dditable; + auto pfnAppendMemBufferFillExp = + dditable->ur.CommandBufferExp.pfnAppendMemBufferFillExp; + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // convert loader handle to platform handle + hBuffer = reinterpret_cast(hBuffer)->handle; + + // forward to device-platform + result = pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7115,20 +7203,24 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnFinalizeExp = ur_loader::urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = ur_loader::urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = - ur_loader::urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = - ur_loader::urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferWriteExp = - ur_loader::urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferReadExp = - ur_loader::urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - ur_loader::urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - ur_loader::urCommandBufferAppendMembufferWriteRectExp; - pDdiTable->pfnAppendMembufferReadRectExp = - ur_loader::urCommandBufferAppendMembufferReadRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = + ur_loader::urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendUSMFillExp = + ur_loader::urCommandBufferAppendUSMFillExp; + pDdiTable->pfnAppendMemBufferCopyExp = + ur_loader::urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferWriteExp = + ur_loader::urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferReadExp = + ur_loader::urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + ur_loader::urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + ur_loader::urCommandBufferAppendMemBufferWriteRectExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + ur_loader::urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferFillExp = + ur_loader::urCommandBufferAppendMemBufferFillExp; pDdiTable->pfnEnqueueExp = ur_loader::urCommandBufferEnqueueExp; } else { // return pointers directly to platform's DDIs diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index e7a75147a5..a61caf39ec 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7105,7 +7105,7 @@ ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( /// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -7118,19 +7118,74 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMemcpyUSMExp = - ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemcpyUSMExp; - if (nullptr == pfnAppendMemcpyUSMExp) { + auto pfnAppendUSMMemcpyExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMMemcpyExp; + if (nullptr == pfnAppendUSMMemcpyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMemcpyUSMExp(hCommandBuffer, pDst, pSrc, size, + return pfnAppendUSMMemcpyExp(hCommandBuffer, pDst, pSrc, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendUSMFillExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMFillExp; + if (nullptr == pfnAppendUSMFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendUSMFillExp(hCommandBuffer, pMemory, pPattern, patternSize, + size, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a memory copy command to a command-buffer object /// @@ -7151,7 +7206,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -7166,13 +7221,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferCopyExp = - ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMembufferCopyExp; - if (nullptr == pfnAppendMembufferCopyExp) { + auto pfnAppendMemBufferCopyExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferCopyExp; + if (nullptr == pfnAppendMemBufferCopyExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferCopyExp( + return pfnAppendMemBufferCopyExp( hCommandBuffer, hSrcMem, hDstMem, srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { @@ -7200,7 +7255,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -7215,13 +7270,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferWriteExp = - ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMembufferWriteExp; - if (nullptr == pfnAppendMembufferWriteExp) { + auto pfnAppendMemBufferWriteExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferWriteExp; + if (nullptr == pfnAppendMemBufferWriteExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferWriteExp(hCommandBuffer, hBuffer, offset, size, + return pfnAppendMemBufferWriteExp(hCommandBuffer, hBuffer, offset, size, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { @@ -7249,7 +7304,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -7263,13 +7318,13 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferReadExp = - ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMembufferReadExp; - if (nullptr == pfnAppendMembufferReadExp) { + auto pfnAppendMemBufferReadExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferReadExp; + if (nullptr == pfnAppendMemBufferReadExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferReadExp(hCommandBuffer, hBuffer, offset, size, + return pfnAppendMemBufferReadExp(hCommandBuffer, hBuffer, offset, size, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { @@ -7296,7 +7351,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -7318,14 +7373,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferCopyRectExp = + auto pfnAppendMemBufferCopyRectExp = ur_lib::context->urDdiTable.CommandBufferExp - .pfnAppendMembufferCopyRectExp; - if (nullptr == pfnAppendMembufferCopyRectExp) { + .pfnAppendMemBufferCopyRectExp; + if (nullptr == pfnAppendMemBufferCopyRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferCopyRectExp( + return pfnAppendMemBufferCopyRectExp( hCommandBuffer, hSrcMem, hDstMem, srcOrigin, dstOrigin, region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -7354,7 +7409,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -7382,14 +7437,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferWriteRectExp = + auto pfnAppendMemBufferWriteRectExp = ur_lib::context->urDdiTable.CommandBufferExp - .pfnAppendMembufferWriteRectExp; - if (nullptr == pfnAppendMembufferWriteRectExp) { + .pfnAppendMemBufferWriteRectExp; + if (nullptr == pfnAppendMemBufferWriteRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferWriteRectExp( + return pfnAppendMemBufferWriteRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -7418,7 +7473,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -7444,14 +7499,14 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command ) try { - auto pfnAppendMembufferReadRectExp = + auto pfnAppendMemBufferReadRectExp = ur_lib::context->urDdiTable.CommandBufferExp - .pfnAppendMembufferReadRectExp; - if (nullptr == pfnAppendMembufferReadRectExp) { + .pfnAppendMemBufferReadRectExp; + if (nullptr == pfnAppendMemBufferReadRectExp) { return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnAppendMembufferReadRectExp( + return pfnAppendMemBufferReadRectExp( hCommandBuffer, hBuffer, bufferOffset, hostOffset, region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); @@ -7459,6 +7514,58 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendMemBufferFillExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendMemBufferFillExp; + if (nullptr == pfnAppendMemBufferFillExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendMemBufferFillExp( + hCommandBuffer, hBuffer, pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// diff --git a/source/ur_api.cpp b/source/ur_api.cpp index e841204835..5dde244596 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6005,7 +6005,7 @@ ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( /// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. void *pDst, ///< [in] Location the data will be copied to. @@ -6022,6 +6022,52 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + If `size` is higher than the allocation size of `ptr` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to fill. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Append a memory copy command to a command-buffer object /// @@ -6042,7 +6088,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6082,7 +6128,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6122,7 +6168,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6160,7 +6206,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hSrcMem, ///< [in] The data to be copied. @@ -6207,7 +6253,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6260,7 +6306,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. @@ -6290,6 +6336,49 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a memory fill command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// + `NULL == hBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pPattern` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + If `offset + size` results in an out-of-bounds access. +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object. + const void *pPattern, ///< [in] pointer to the fill pattern. + size_t patternSize, ///< [in] size in bytes of the pattern. + size_t offset, ///< [in] offset into the buffer. + size_t + size, ///< [in] fill size in bytes, must be a multiple of patternSize. + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// From 26b9d82f168af12e9449f9603530d70398b007aa Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Mon, 28 Aug 2023 14:24:21 +0100 Subject: [PATCH 007/145] [UR] List available tests and track crashes --- scripts/ctest_parser.py | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/scripts/ctest_parser.py b/scripts/ctest_parser.py index d84bbc8f01..01e7867579 100644 --- a/scripts/ctest_parser.py +++ b/scripts/ctest_parser.py @@ -25,12 +25,14 @@ def summarize_results(results): total_passed = len(results['Passed']) total_skipped = len(results['Skipped']) total_failed = len(results['Failed']) + total_crashed = total - (total_passed + total_skipped + total_failed) pass_rate_incl_skipped = percent(total_passed, total) pass_rate_excl_skipped = percent(total_passed, total - total_skipped) skipped_rate = percent(total_skipped, total) failed_rate = percent(total_failed, total) + crash_rate = percent(total_crashed, total) ljust_param = len(str(total)) @@ -40,18 +42,20 @@ def summarize_results(results): Passed [{str(total_passed).ljust(ljust_param)}] ({pass_rate_incl_skipped}%) - ({pass_rate_excl_skipped}% with skipped tests excluded) Skipped [{str(total_skipped).ljust(ljust_param)}] ({skipped_rate}%) Failed [{str(total_failed).ljust(ljust_param)}] ({failed_rate}%) + Crashed [{str(total_crashed).ljust(ljust_param)}] ({crash_rate}%) """ ) def parse_results(results): - parsed_results = {"Passed": {}, "Skipped":{}, "Failed": {}, 'Total':0, 'Success':True} + parsed_results = {"Passed": {}, "Skipped":{}, "Failed": {}, 'Crashed': {}, 'Total':0, 'Success':True} for _, result in results.items(): - if result is None: + if result['actual'] is None: parsed_results['Success'] = False + parsed_results['Total'] += result['expected']['tests'] continue - parsed_results['Total'] += result['tests'] - for testsuite in result.get('testsuites'): + parsed_results['Total'] += result['actual']['tests'] + for testsuite in result['actual'].get('testsuites'): for test in testsuite.get('testsuite'): test_name = f"{testsuite['name']}.{test['name']}" test_time = test['time'] @@ -63,7 +67,6 @@ def parse_results(results): parsed_results['Passed'][test_name] = {'time': test_time} return parsed_results - def run(args): results = {} @@ -71,6 +74,22 @@ def run(args): env = os.environ.copy() env['GTEST_OUTPUT'] = f"json:{tmp_results_file}" + ## try and list all the available tests + for suite in CTS_TEST_SUITES: + results[suite] = {} + test_executable = f"{args.ctest_path}/bin/test-{suite}" + process = Popen([test_executable, "--gtest_list_tests"], env=env, + stdout=DEVNULL if args.quiet else None, + stderr=DEVNULL if args.quiet else None) + process.wait() + try: + with open(tmp_results_file,'r') as test_list: + all_tests = json.load(test_list) + results[suite]['expected'] = all_tests + os.remove(tmp_results_file) + except FileNotFoundError: + print(f"Could not discover tests for {suite}") + for suite in CTS_TEST_SUITES: ctest_path = f"{args.ctest_path}/test/conformance/{suite}" process = Popen(['ctest',ctest_path], env=env, cwd=ctest_path, @@ -81,10 +100,10 @@ def run(args): try: with open(tmp_results_file, 'r') as results_file: json_data = json.load(results_file) - results[suite] = json_data + results[suite]['actual'] = json_data os.remove(tmp_results_file) except FileNotFoundError: - results[suite] = None + results[suite]['actual'] = None print('\033[91m' + f"Conformance test suite '{suite}' : likely crashed!" + '\033[0m') return results From b079f63f05aed533beb34d0a5cfc422e841c52ba Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Tue, 29 Aug 2023 11:04:25 +0100 Subject: [PATCH 008/145] [UR] Fetch testsuite names from ctest --- scripts/ctest_parser.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/ctest_parser.py b/scripts/ctest_parser.py index 01e7867579..f41ba5ea60 100644 --- a/scripts/ctest_parser.py +++ b/scripts/ctest_parser.py @@ -7,15 +7,19 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception """ -from subprocess import Popen, DEVNULL +from subprocess import Popen, DEVNULL, PIPE import argparse import os import json TMP_RESULTS_FILE = "tmp-results-file.json" -CTS_TEST_SUITES = ["context", "device", "enqueue", "event", "kernel", "memory", - "platform", "program", "queue", "runtime", "sampler", "usm", - "virtual_memory"] + +def get_cts_test_suite_names(working_directory): + process = Popen(["ctest", "--show-only=json-v1"], cwd=working_directory, + stdout=PIPE, env=os.environ.copy()) + out,_ = process.communicate() + testsuites = json.loads(out) + return [test['name']for test in testsuites['tests']] def percent(amount, total): return round((amount / total) * 100, 2) @@ -74,8 +78,10 @@ def run(args): env = os.environ.copy() env['GTEST_OUTPUT'] = f"json:{tmp_results_file}" + test_suite_names = get_cts_test_suite_names(f"{args.ctest_path}/test/conformance/") + ## try and list all the available tests - for suite in CTS_TEST_SUITES: + for suite in test_suite_names: results[suite] = {} test_executable = f"{args.ctest_path}/bin/test-{suite}" process = Popen([test_executable, "--gtest_list_tests"], env=env, @@ -90,7 +96,7 @@ def run(args): except FileNotFoundError: print(f"Could not discover tests for {suite}") - for suite in CTS_TEST_SUITES: + for suite in test_suite_names: ctest_path = f"{args.ctest_path}/test/conformance/{suite}" process = Popen(['ctest',ctest_path], env=env, cwd=ctest_path, stdout=DEVNULL if args.quiet else None, From 2580e0805bba0613483f5edc95fc78b0817def48 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Thu, 31 Aug 2023 10:14:30 +0100 Subject: [PATCH 009/145] [UR] Fixup minor CTS issues --- test/conformance/event/urEventSetCallback.cpp | 7 ++++--- test/conformance/memory/urMemGetInfo.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/conformance/event/urEventSetCallback.cpp b/test/conformance/event/urEventSetCallback.cpp index 18eb8e00db..e238b4534d 100644 --- a/test/conformance/event/urEventSetCallback.cpp +++ b/test/conformance/event/urEventSetCallback.cpp @@ -168,20 +168,21 @@ using urEventSetCallbackNegativeTest = uur::event::urEventTest; void emptyCallback(ur_event_handle_t hEvent, ur_execution_info_t execStatus, void *pUserData) {} -TEST_P(urEventSetCallbackNegativeTest, InvalidNullHandle) { - +TEST_P(urEventSetCallbackNegativeTest, InvalidNullHandleEvent) { ASSERT_EQ_RESULT( urEventSetCallback( nullptr, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED, emptyCallback, nullptr), UR_RESULT_ERROR_INVALID_NULL_HANDLE); +} +TEST_P(urEventSetCallbackNegativeTest, InvalidNullPointerCallback) { ASSERT_EQ_RESULT( urEventSetCallback( event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED, nullptr, nullptr), - UR_RESULT_ERROR_INVALID_NULL_HANDLE); + UR_RESULT_ERROR_INVALID_NULL_POINTER); } TEST_P(urEventSetCallbackNegativeTest, InvalidEnumeration) { diff --git a/test/conformance/memory/urMemGetInfo.cpp b/test/conformance/memory/urMemGetInfo.cpp index 355c2c009d..18ec119681 100644 --- a/test/conformance/memory/urMemGetInfo.cpp +++ b/test/conformance/memory/urMemGetInfo.cpp @@ -63,11 +63,11 @@ TEST_P(urMemGetInfoTest, InvalidNullPointerParamValue) { size_t mem_size = 0; ASSERT_EQ_RESULT(urMemGetInfo(buffer, UR_MEM_INFO_SIZE, sizeof(mem_size), nullptr, nullptr), - UR_RESULT_ERROR_INVALID_SIZE); + UR_RESULT_ERROR_INVALID_NULL_POINTER); } TEST_P(urMemGetInfoTest, InvalidNullPointerPropSizeRet) { ASSERT_EQ_RESULT( urMemGetInfo(buffer, UR_MEM_INFO_SIZE, 0, nullptr, nullptr), - UR_RESULT_ERROR_INVALID_SIZE); + UR_RESULT_ERROR_INVALID_NULL_POINTER); } From a8e4955a516fdc53a90e7f1da9eb89a1a8133755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio?= Date: Thu, 31 Aug 2023 12:05:51 +0100 Subject: [PATCH 010/145] Fix device CTS tests (#834) --- include/ur_api.h | 6 ++++-- scripts/core/device.yml | 4 +++- source/adapters/null/ur_nullddi.cpp | 4 ++-- source/loader/layers/tracing/ur_trcddi.cpp | 4 ++-- source/loader/layers/validation/ur_valddi.cpp | 8 ++++++-- source/loader/ur_ldrddi.cpp | 4 ++-- source/loader/ur_libapi.cpp | 6 ++++-- source/ur_api.cpp | 6 ++++-- test/conformance/device/urDeviceGetInfo.cpp | 12 ++++++++++++ 9 files changed, 39 insertions(+), 15 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 1508dcf86b..258ea85e7a 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -1301,14 +1301,16 @@ typedef enum ur_device_type_t { /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_VALUE UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t *phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. ///< If NumEntries is less than the number of devices available, then diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 27f2100feb..4d304dc12f 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -131,7 +131,7 @@ params: name: NumEntries desc: | [in] the number of devices to be added to phDevices. - If phDevices in not NULL then NumEntries should be greater than zero, otherwise $X_RESULT_ERROR_INVALID_VALUE, + If phDevices is not NULL, then NumEntries should be greater than zero. Otherwise $X_RESULT_ERROR_INVALID_SIZE will be returned. - type: "$x_device_handle_t*" name: phDevices @@ -144,6 +144,8 @@ params: [out][optional] pointer to the number of devices. pNumDevices will be updated with the total number of devices available. returns: + - $X_RESULT_ERROR_INVALID_SIZE: + - "`NumEntries == 0 && phDevices != NULL`" - $X_RESULT_ERROR_INVALID_VALUE --- #-------------------------------------------------------------------------- type: enum diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 29d2faef98..cb87343945 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -320,8 +320,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t * phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index dee41bc1c1..64702ebed5 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -357,8 +357,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t * phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index efcc2cd9c3..2e36eeeb2c 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -398,8 +398,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t * phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. @@ -422,6 +422,10 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( if (UR_DEVICE_TYPE_VPU < DeviceType) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } + + if (NumEntries == 0 && phDevices != NULL) { + return UR_RESULT_ERROR_INVALID_SIZE; + } } ur_result_t result = diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 7776758069..7094cb0304 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -440,8 +440,8 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t * phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index a61caf39ec..5d0b64d922 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -712,14 +712,16 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGet( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t * phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 5dde244596..1d6371781b 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -616,14 +616,16 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// + `NULL == hPlatform` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_DEVICE_TYPE_VPU < DeviceType` +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phDevices != NULL` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGet( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance ur_device_type_t DeviceType, ///< [in] the type of the devices. uint32_t NumEntries, ///< [in] the number of devices to be added to phDevices. - ///< If phDevices in not NULL then NumEntries should be greater than zero, - ///< otherwise ::UR_RESULT_ERROR_INVALID_VALUE, + ///< If phDevices is not NULL, then NumEntries should be greater than zero. + ///< Otherwise ::UR_RESULT_ERROR_INVALID_SIZE ///< will be returned. ur_device_handle_t * phDevices, ///< [out][optional][range(0, NumEntries)] array of handle of devices. diff --git a/test/conformance/device/urDeviceGetInfo.cpp b/test/conformance/device/urDeviceGetInfo.cpp index e5e9f7c310..757e09b6fa 100644 --- a/test/conformance/device/urDeviceGetInfo.cpp +++ b/test/conformance/device/urDeviceGetInfo.cpp @@ -240,6 +240,14 @@ INSTANTIATE_TEST_SUITE_P( return ss.str(); }); +bool doesReturnArray(ur_device_info_t info_type) { + if (info_type == UR_DEVICE_INFO_SUPPORTED_PARTITIONS || + info_type == UR_DEVICE_INFO_PARTITION_TYPE) { + return true; + } + return false; +} + TEST_P(urDeviceGetInfoTest, Success) { ur_device_info_t info_type = GetParam(); for (auto device : devices) { @@ -248,7 +256,11 @@ TEST_P(urDeviceGetInfoTest, Success) { urDeviceGetInfo(device, info_type, 0, nullptr, &size); if (result == UR_RESULT_SUCCESS) { + if (doesReturnArray(info_type) && size == 0) { + return; + } ASSERT_NE(size, 0); + if (const auto expected_size = device_info_size_map.find(info_type); expected_size != device_info_size_map.end()) { ASSERT_EQ(expected_size->second, size); From fd93ee03c234f1beb70a0bbde323e2c1504b514f Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Fri, 1 Sep 2023 12:01:37 +0200 Subject: [PATCH 011/145] Move nightly CI tests to the main branch Fuzz tests set up with cron don't run because cron scheduled workflows are triggered only for the default branch. Add nightly workflow file to the default branch with fuzz tests specified to run on 'adapters' branch. --- .github/workflows/nightly.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..527f641a51 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,53 @@ +name: Nightly + +on: + schedule: + # Run every day at 23:00 UTC + - cron: '0 23 * * *' + +jobs: + long-fuzz-test: + name: Run long fuzz tests + strategy: + matrix: + build_type: [Debug, Release] + compiler: [{c: clang, cxx: clang++}] + + runs-on: 'ubuntu-22.04' + + steps: + - uses: actions/checkout@v3 + # with-ref part to be removed after merging 'adapters' branch with 'main' + with: + ref: adapters + + - name: Install pip packages + run: pip install -r third_party/requirements.txt + + - name: Download DPC++ + run: | + wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-08-31/sycl_linux.tar.gz + mkdir dpcpp_compiler + tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz -C dpcpp_compiler + + - name: Configure CMake + run: > + cmake + -B${{github.workspace}}/build + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} + -DUR_ENABLE_TRACING=ON + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} + -DUR_BUILD_TESTS=ON + -DUR_USE_ASAN=ON + -DUR_USE_UBSAN=ON + -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ + + - name: Build + run: > + LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib + cmake --build ${{github.workspace}}/build -j $(nproc) + + - name: Fuzz long test + working-directory: ${{github.workspace}}/build + run: ctest -C ${{matrix.build_type}} --output-on-failure -L "fuzz-long" From 7b5956ae330e355fc9db45f8da4472c2825e20f1 Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Fri, 1 Sep 2023 11:42:56 +0200 Subject: [PATCH 012/145] Speed up CI jobs --- .github/workflows/bandit.yml | 5 ----- .github/workflows/codeql.yml | 12 ++---------- .github/workflows/coverity.yml | 10 +--------- 3 files changed, 3 insertions(+), 24 deletions(-) diff --git a/.github/workflows/bandit.yml b/.github/workflows/bandit.yml index b15e924a7e..ce1cb64c42 100644 --- a/.github/workflows/bandit.yml +++ b/.github/workflows/bandit.yml @@ -12,11 +12,6 @@ jobs: - name: Clone the git repo uses: actions/checkout@v3 - - name: Install apt packages - run: | - sudo apt-get update - sudo apt-get install -y doxygen - - name: Install pip packages run: pip install -r third_party/requirements.txt diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 701a3be4a2..c7f7c95ba4 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -11,8 +11,6 @@ jobs: strategy: fail-fast: false - matrix: - language: [ 'cpp', 'python' ] steps: - name: Checkout repository @@ -21,7 +19,7 @@ jobs: - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: - languages: ${{ matrix.language }} + languages: cpp, python - name: Install pip packages run: pip install -r third_party/requirements.txt @@ -34,8 +32,6 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" analyze-windows: name: Analyze on Windows @@ -45,8 +41,6 @@ jobs: strategy: fail-fast: false - matrix: - language: [ 'cpp', 'python' ] steps: - name: Checkout repository @@ -55,7 +49,7 @@ jobs: - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: - languages: ${{ matrix.language }} + languages: cpp, python - name: Install pip packages run: python3 -m pip install -r third_party/requirements.txt @@ -68,5 +62,3 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 - with: - category: "/language:${{matrix.language}}" diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml index ed6cd31ca9..de327f92c7 100644 --- a/.github/workflows/coverity.yml +++ b/.github/workflows/coverity.yml @@ -31,20 +31,12 @@ jobs: - name: Clone the git repo uses: actions/checkout@v3 - - name: Install apt packages - run: | - sudo apt-get update - sudo apt-get install -y doxygen - - name: Install pip packages run: pip install -r third_party/requirements.txt - name: Configure CMake - run: cmake -B $WORKDIR/build -DUR_ENABLE_TRACING=ON -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUR_FORMAT_CPP_STYLE=ON -DUMF_ENABLE_POOL_TRACKING=ON + run: cmake -B $WORKDIR/build -DUR_ENABLE_TRACING=ON -DUR_DEVELOPER_MODE=ON -DUR_BUILD_TESTS=ON -DUMF_ENABLE_POOL_TRACKING=ON - - name: Generate source from spec, check for uncommitted diff - run: | - cmake --build $WORKDIR/build --target check-generated - name: Run Coverity run: | cd $WORKDIR/build From 4c7cb303fd0c723c29a72686aab87d1c145461cc Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Thu, 10 Aug 2023 22:02:43 +0000 Subject: [PATCH 013/145] [umf] add critnib datastructure Taken from: https://github.com/kilobyte/critnib/commit/fae4b85f1616b607bce4b64a302bd79c43692c77 --- .../src/critnib/critnib.c | 810 ++++++++++++++++++ .../src/critnib/critnib.h | 48 ++ .../src/critnib/pmdk-compat.h | 78 ++ 3 files changed, 936 insertions(+) create mode 100644 source/common/unified_malloc_framework/src/critnib/critnib.c create mode 100644 source/common/unified_malloc_framework/src/critnib/critnib.h create mode 100644 source/common/unified_malloc_framework/src/critnib/pmdk-compat.h diff --git a/source/common/unified_malloc_framework/src/critnib/critnib.c b/source/common/unified_malloc_framework/src/critnib/critnib.c new file mode 100644 index 0000000000..18b0e660c8 --- /dev/null +++ b/source/common/unified_malloc_framework/src/critnib/critnib.c @@ -0,0 +1,810 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + */ + +/* + * critnib.c -- implementation of critnib tree + * + * It offers identity lookup (like a hashmap) and <= lookup (like a search + * tree). Unlike some hashing algorithms (cuckoo hash, perfect hashing) the + * complexity isn't constant, but for data sizes we expect it's several + * times as fast as cuckoo, and has no "stop the world" cases that would + * cause latency (ie, better worst case behaviour). + */ + +/* + * STRUCTURE DESCRIPTION + * + * Critnib is a hybrid between a radix tree and DJ Bernstein's critbit: + * it skips nodes for uninteresting radix nodes (ie, ones that would have + * exactly one child), this requires adding to every node a field that + * describes the slice (4-bit in our case) that this radix level is for. + * + * This implementation also stores each node's path (ie, bits that are + * common to every key in that subtree) -- this doesn't help with lookups + * at all (unused in == match, could be reconstructed at no cost in <= + * after first dive) but simplifies inserts and removes. If we ever want + * that piece of memory it's easy to trim it down. + */ + +/* + * CONCURRENCY ISSUES + * + * Reads are completely lock-free sync-free, but only almost wait-free: + * if for some reason a read thread gets pathologically stalled, it will + * notice the data being stale and restart the work. In usual cases, + * the structure having been modified does _not_ cause a restart. + * + * Writes could be easily made lock-free as well (with only a cmpxchg + * sync), but this leads to problems with removes. A possible solution + * would be doing removes by overwriting by NULL w/o freeing -- yet this + * would lead to the structure growing without bounds. Complex per-node + * locks would increase concurrency but they slow down individual writes + * enough that in practice a simple global write lock works faster. + * + * Removes are the only operation that can break reads. The structure + * can do local RCU well -- the problem being knowing when it's safe to + * free. Any synchronization with reads would kill their speed, thus + * instead we have a remove count. The grace period is DELETED_LIFE, + * after which any read will notice staleness and restart its work. + */ +#include +#include +#include + +#include "critnib.h" +#include "pmdk-compat.h" + +/* + * A node that has been deleted is left untouched for this many delete + * cycles. Reads have guaranteed correctness if they took no longer than + * DELETED_LIFE concurrent deletes, otherwise they notice something is + * wrong and restart. The memory of deleted nodes is never freed to + * malloc nor their pointers lead anywhere wrong, thus a stale read will + * (temporarily) get a wrong answer but won't crash. + * + * There's no need to count writes as they never interfere with reads. + * + * Allowing stale reads (of arbitrarily old writes or of deletes less than + * DELETED_LIFE old) might sound counterintuitive, but it doesn't affect + * semantics in any way: the thread could have been stalled just after + * returning from our code. Thus, the guarantee is: the result of get() or + * find_le() is a value that was current at any point between the call + * start and end. + */ +#define DELETED_LIFE 16 + +#define SLICE 4 +#define NIB ((1UL << SLICE) - 1) +#define SLNODES (1 << SLICE) + +typedef uintptr_t word; +typedef unsigned char sh_t; + +struct critnib_node { + /* + * path is the part of a tree that's already traversed (be it through + * explicit nodes or collapsed links) -- ie, any subtree below has all + * those bits set to this value. + * + * nib is a 4-bit slice that's an index into the node's children. + * + * shift is the length (in bits) of the part of the key below this node. + * + * nib + * |XXXXXXXXXX|?|*****| + * path ^ + * +-----+ + * shift + */ + struct critnib_node *child[SLNODES]; + word path; + sh_t shift; +}; + +struct critnib_leaf { + word key; + void *value; +}; + +struct critnib { + struct critnib_node *root; + + /* pool of freed nodes: singly linked list, next at child[0] */ + struct critnib_node *deleted_node; + struct critnib_leaf *deleted_leaf; + + /* nodes removed but not yet eligible for reuse */ + struct critnib_node *pending_del_nodes[DELETED_LIFE]; + struct critnib_leaf *pending_del_leaves[DELETED_LIFE]; + + uint64_t remove_count; + + os_mutex_t mutex; /* writes/removes */ +}; + +/* + * atomic load + */ +static void load(void *src, void *dst) { + __atomic_load((word *)src, (word *)dst, memory_order_acquire); +} + +static void load64(uint64_t *src, uint64_t *dst) { + __atomic_load(src, dst, memory_order_acquire); +} + +/* + * atomic store + */ +static void store(void *dst, void *src) { + __atomic_store_n((word *)dst, (word)src, memory_order_release); +} + +/* + * internal: is_leaf -- check tagged pointer for leafness + */ +static inline bool is_leaf(struct critnib_node *n) { return (word)n & 1; } + +/* + * internal: to_leaf -- untag a leaf pointer + */ +static inline struct critnib_leaf *to_leaf(struct critnib_node *n) { + return (void *)((word)n & ~1UL); +} + +/* + * internal: path_mask -- return bit mask of a path above a subtree [shift] + * bits tall + */ +static inline word path_mask(sh_t shift) { return ~NIB << shift; } + +/* + * internal: slice_index -- return index of child at the given nib + */ +static inline unsigned slice_index(word key, sh_t shift) { + return (unsigned)((key >> shift) & NIB); +} + +/* + * critnib_new -- allocates a new critnib structure + */ +struct critnib *critnib_new(void) { + struct critnib *c = Zalloc(sizeof(struct critnib)); + if (!c) { + return NULL; + } + + util_mutex_init(&c->mutex); + + VALGRIND_HG_DRD_DISABLE_CHECKING(&c->root, sizeof(c->root)); + VALGRIND_HG_DRD_DISABLE_CHECKING(&c->remove_count, sizeof(c->remove_count)); + + return c; +} + +/* + * internal: delete_node -- recursively free (to malloc) a subtree + */ +static void delete_node(struct critnib_node *__restrict n) { + if (is_leaf(n)) { + Free(to_leaf(n)); + } else { + for (int i = 0; i < SLNODES; i++) { + if (n->child[i]) { + delete_node(n->child[i]); + } + } + + Free(n); + } +} + +/* + * critnib_delete -- destroy and free a critnib struct + */ +void critnib_delete(struct critnib *c) { + if (c->root) { + delete_node(c->root); + } + + util_mutex_destroy(&c->mutex); + + for (struct critnib_node *m = c->deleted_node; m;) { + struct critnib_node *mm = m->child[0]; + Free(m); + m = mm; + } + + for (struct critnib_leaf *k = c->deleted_leaf; k;) { + struct critnib_leaf *kk = k->value; + Free(k); + k = kk; + } + + for (int i = 0; i < DELETED_LIFE; i++) { + Free(c->pending_del_nodes[i]); + Free(c->pending_del_leaves[i]); + } + + Free(c); +} + +/* + * internal: free_node -- free (to internal pool, not malloc) a node. + * + * We cannot free them to malloc as a stalled reader thread may still walk + * through such nodes; it will notice the result being bogus but only after + * completing the walk, thus we need to ensure any freed nodes still point + * to within the critnib structure. + */ +static void free_node(struct critnib *__restrict c, + struct critnib_node *__restrict n) { + if (!n) { + return; + } + + ASSERT(!is_leaf(n)); + n->child[0] = c->deleted_node; + c->deleted_node = n; +} + +/* + * internal: alloc_node -- allocate a node from our pool or from malloc + */ +static struct critnib_node *alloc_node(struct critnib *__restrict c) { + if (!c->deleted_node) { + return Malloc(sizeof(struct critnib_node)); + } + + struct critnib_node *n = c->deleted_node; + + c->deleted_node = n->child[0]; + VALGRIND_ANNOTATE_NEW_MEMORY(n, sizeof(*n)); + + return n; +} + +/* + * internal: free_leaf -- free (to internal pool, not malloc) a leaf. + * + * See free_node(). + */ +static void free_leaf(struct critnib *__restrict c, + struct critnib_leaf *__restrict k) { + if (!k) { + return; + } + + k->value = c->deleted_leaf; + c->deleted_leaf = k; +} + +/* + * internal: alloc_leaf -- allocate a leaf from our pool or from malloc + */ +static struct critnib_leaf *alloc_leaf(struct critnib *__restrict c) { + if (!c->deleted_leaf) { + return Malloc(sizeof(struct critnib_leaf)); + } + + struct critnib_leaf *k = c->deleted_leaf; + + c->deleted_leaf = k->value; + VALGRIND_ANNOTATE_NEW_MEMORY(k, sizeof(*k)); + + return k; +} + +/* + * crinib_insert -- write a key:value pair to the critnib structure + * + * Returns: + * • 0 on success + * • EEXIST if such a key already exists + * • ENOMEM if we're out of memory + * + * Takes a global write lock but doesn't stall any readers. + */ +int critnib_insert(struct critnib *c, word key, void *value, int update) { + util_mutex_lock(&c->mutex); + + struct critnib_leaf *k = alloc_leaf(c); + if (!k) { + util_mutex_unlock(&c->mutex); + + return ENOMEM; + } + + VALGRIND_HG_DRD_DISABLE_CHECKING(k, sizeof(struct critnib_leaf)); + + k->key = key; + k->value = value; + + struct critnib_node *kn = (void *)((word)k | 1); + + struct critnib_node *n = c->root; + if (!n) { + c->root = kn; + + util_mutex_unlock(&c->mutex); + + return 0; + } + + struct critnib_node **parent = &c->root; + struct critnib_node *prev = c->root; + + while (n && !is_leaf(n) && (key & path_mask(n->shift)) == n->path) { + prev = n; + parent = &n->child[slice_index(key, n->shift)]; + n = *parent; + } + + if (!n) { + n = prev; + store(&n->child[slice_index(key, n->shift)], kn); + + util_mutex_unlock(&c->mutex); + + return 0; + } + + word path = is_leaf(n) ? to_leaf(n)->key : n->path; + /* Find where the path differs from our key. */ + word at = path ^ key; + if (!at) { + ASSERT(is_leaf(n)); + free_leaf(c, to_leaf(kn)); + + if (update) { + to_leaf(n)->value = value; + util_mutex_unlock(&c->mutex); + return 0; + } else { + util_mutex_unlock(&c->mutex); + return EEXIST; + } + } + + /* and convert that to an index. */ + sh_t sh = util_mssb_index(at) & (sh_t) ~(SLICE - 1); + + struct critnib_node *m = alloc_node(c); + if (!m) { + free_leaf(c, to_leaf(kn)); + + util_mutex_unlock(&c->mutex); + + return ENOMEM; + } + VALGRIND_HG_DRD_DISABLE_CHECKING(m, sizeof(struct critnib_node)); + + for (int i = 0; i < SLNODES; i++) { + m->child[i] = NULL; + } + + m->child[slice_index(key, sh)] = kn; + m->child[slice_index(path, sh)] = n; + m->shift = sh; + m->path = key & path_mask(sh); + store(parent, m); + + util_mutex_unlock(&c->mutex); + + return 0; +} + +/* + * critnib_remove -- delete a key from the critnib structure, return its value + */ +void *critnib_remove(struct critnib *c, word key) { + struct critnib_leaf *k; + void *value = NULL; + + util_mutex_lock(&c->mutex); + + struct critnib_node *n = c->root; + if (!n) { + goto not_found; + } + + word del = __atomic_fetch_add(&c->remove_count, 1, __ATOMIC_ACQ_REL) % + DELETED_LIFE; + free_node(c, c->pending_del_nodes[del]); + free_leaf(c, c->pending_del_leaves[del]); + c->pending_del_nodes[del] = NULL; + c->pending_del_leaves[del] = NULL; + + if (is_leaf(n)) { + k = to_leaf(n); + if (k->key == key) { + store(&c->root, NULL); + goto del_leaf; + } + + goto not_found; + } + /* + * n and k are a parent:child pair (after the first iteration); k is the + * leaf that holds the key we're deleting. + */ + struct critnib_node **k_parent = &c->root; + struct critnib_node **n_parent = &c->root; + struct critnib_node *kn = n; + + while (!is_leaf(kn)) { + n_parent = k_parent; + n = kn; + k_parent = &kn->child[slice_index(key, kn->shift)]; + kn = *k_parent; + + if (!kn) { + goto not_found; + } + } + + k = to_leaf(kn); + if (k->key != key) { + goto not_found; + } + + store(&n->child[slice_index(key, n->shift)], NULL); + + /* Remove the node if there's only one remaining child. */ + int ochild = -1; + for (int i = 0; i < SLNODES; i++) { + if (n->child[i]) { + if (ochild != -1) { + goto del_leaf; + } + + ochild = i; + } + } + + ASSERTne(ochild, -1); + + store(n_parent, n->child[ochild]); + c->pending_del_nodes[del] = n; + +del_leaf: + value = k->value; + c->pending_del_leaves[del] = k; + +not_found: + util_mutex_unlock(&c->mutex); + return value; +} + +/* + * critnib_get -- query for a key ("==" match), returns value or NULL + * + * Doesn't need a lock but if many deletes happened while our thread was + * somehow stalled the query is restarted (as freed nodes remain unused only + * for a grace period). + * + * Counterintuitively, it's pointless to return the most current answer, + * we need only one that was valid at any point after the call started. + */ +void *critnib_get(struct critnib *c, word key) { + uint64_t wrs1, wrs2; + void *res; + + do { + struct critnib_node *n; + + load64(&c->remove_count, &wrs1); + load(&c->root, &n); + + /* + * critbit algorithm: dive into the tree, looking at nothing but + * each node's critical bit^H^H^Hnibble. This means we risk + * going wrong way if our path is missing, but that's ok... + */ + while (n && !is_leaf(n)) { + load(&n->child[slice_index(key, n->shift)], &n); + } + + /* ... as we check it at the end. */ + struct critnib_leaf *k = to_leaf(n); + res = (n && k->key == key) ? k->value : NULL; + load64(&c->remove_count, &wrs2); + } while (wrs1 + DELETED_LIFE <= wrs2); + + return res; +} + +/* + * internal: find_predecessor -- return the rightmost leaf in a subtree + */ +static struct critnib_leaf * +find_predecessor(struct critnib_node *__restrict n) { + while (1) { + int nib; + for (nib = NIB; nib >= 0; nib--) { + if (n->child[nib]) { + break; + } + } + + if (nib < 0) { + return NULL; + } + + n = n->child[nib]; + if (is_leaf(n)) { + return to_leaf(n); + } + } +} + +/* + * internal: find_le -- recursively search <= in a subtree + */ +static struct critnib_leaf *find_le(struct critnib_node *__restrict n, + word key) { + if (!n) { + return NULL; + } + + if (is_leaf(n)) { + struct critnib_leaf *k = to_leaf(n); + return (k->key <= key) ? k : NULL; + } + + /* + * is our key outside the subtree we're in? + * + * If we're inside, all bits above the nib will be identical; note + * that shift points at the nib's lower rather than upper edge, so it + * needs to be masked away as well. + */ + if ((key ^ n->path) >> (n->shift) & ~NIB) { + /* + * subtree is too far to the left? + * -> its rightmost value is good + */ + if (n->path < key) { + return find_predecessor(n); + } + + /* + * subtree is too far to the right? + * -> it has nothing of interest to us + */ + return NULL; + } + + unsigned nib = slice_index(key, n->shift); + /* recursive call: follow the path */ + { + struct critnib_node *m; + load(&n->child[nib], &m); + struct critnib_leaf *k = find_le(m, key); + if (k) { + return k; + } + } + + /* + * nothing in that subtree? We strayed from the path at this point, + * thus need to search every subtree to our left in this node. No + * need to dive into any but the first non-null, though. + */ + for (; nib > 0; nib--) { + struct critnib_node *m; + load(&n->child[nib - 1], &m); + if (m) { + n = m; + if (is_leaf(n)) { + return to_leaf(n); + } + + return find_predecessor(n); + } + } + + return NULL; +} + +/* + * critnib_find_le -- query for a key ("<=" match), returns value or NULL + * + * Same guarantees as critnib_get(). + */ +void *critnib_find_le(struct critnib *c, word key) { + uint64_t wrs1, wrs2; + void *res; + + do { + load64(&c->remove_count, &wrs1); + struct critnib_node *n; /* avoid a subtle TOCTOU */ + load(&c->root, &n); + struct critnib_leaf *k = n ? find_le(n, key) : NULL; + res = k ? k->value : NULL; + load64(&c->remove_count, &wrs2); + } while (wrs1 + DELETED_LIFE <= wrs2); + + return res; +} + +/* + * internal: find_successor -- return the rightmost leaf in a subtree + */ +static struct critnib_leaf *find_successor(struct critnib_node *__restrict n) { + while (1) { + unsigned nib; + for (nib = 0; nib <= NIB; nib++) { + if (n->child[nib]) { + break; + } + } + + if (nib > NIB) { + return NULL; + } + + n = n->child[nib]; + if (is_leaf(n)) { + return to_leaf(n); + } + } +} + +/* + * internal: find_ge -- recursively search >= in a subtree + */ +static struct critnib_leaf *find_ge(struct critnib_node *__restrict n, + word key) { + if (!n) { + return NULL; + } + + if (is_leaf(n)) { + struct critnib_leaf *k = to_leaf(n); + return (k->key >= key) ? k : NULL; + } + + if ((key ^ n->path) >> (n->shift) & ~NIB) { + if (n->path > key) { + return find_successor(n); + } + + return NULL; + } + + unsigned nib = slice_index(key, n->shift); + { + struct critnib_node *m; + load(&n->child[nib], &m); + struct critnib_leaf *k = find_ge(m, key); + if (k) { + return k; + } + } + + for (; nib < NIB; nib++) { + struct critnib_node *m; + load(&n->child[nib + 1], &m); + if (m) { + n = m; + if (is_leaf(n)) { + return to_leaf(n); + } + + return find_successor(n); + } + } + + return NULL; +} + +/* + * critnib_find -- parametrized query, returns 1 if found + */ +int critnib_find(struct critnib *c, uintptr_t key, enum find_dir_t dir, + uintptr_t *rkey, void **rvalue) { + uint64_t wrs1, wrs2; + struct critnib_leaf *k; + uintptr_t _rkey; + void **_rvalue; + + /* <42 ≡ ≤41 */ + if (dir < -1) { + if (!key) { + return 0; /* no key is <0 */ + } + key--; + } else if (dir > +1) { + if (key == (uintptr_t)-1) { + return 0; /* no key is >(unsigned)∞ */ + } + key++; + } + + do { + load64(&c->remove_count, &wrs1); + struct critnib_node *n; + load(&c->root, &n); + + if (dir < 0) { + k = find_le(n, key); + } else if (dir > 0) { + k = find_ge(n, key); + } else { + while (n && !is_leaf(n)) { + load(&n->child[slice_index(key, n->shift)], &n); + } + + struct critnib_leaf *kk = to_leaf(n); + k = (n && kk->key == key) ? kk : NULL; + } + if (k) { + _rkey = k->key; + _rvalue = k->value; + } + load64(&c->remove_count, &wrs2); + } while (wrs1 + DELETED_LIFE <= wrs2); + + if (k) { + if (rkey) { + *rkey = _rkey; + } + if (rvalue) { + *rvalue = _rvalue; + } + return 1; + } + + return 0; +} + +/* + * critnib_iter -- iterator, [min..max], calls func(key, value, privdata) + * + * If func() returns non-zero, the search is aborted. + */ +static int iter(struct critnib_node *__restrict n, word min, word max, + int (*func)(word key, void *value, void *privdata), + void *privdata) { + if (is_leaf(n)) { + word k = to_leaf(n)->key; + if (k >= min && k <= max) { + return func(to_leaf(n)->key, to_leaf(n)->value, privdata); + } + return 0; + } + + if (n->path > max) { + return 1; + } + if ((n->path | path_mask(n->shift)) < min) { + return 0; + } + + for (int i = 0; i < SLNODES; i++) { + struct critnib_node *__restrict m = n->child[i]; + if (m && iter(m, min, max, func, privdata)) { + return 1; + } + } + + return 0; +} + +void critnib_iter(critnib *c, uintptr_t min, uintptr_t max, + int (*func)(uintptr_t key, void *value, void *privdata), + void *privdata) { + util_mutex_lock(&c->mutex); + if (c->root) { + iter(c->root, min, max, func, privdata); + } + util_mutex_unlock(&c->mutex); +} diff --git a/source/common/unified_malloc_framework/src/critnib/critnib.h b/source/common/unified_malloc_framework/src/critnib/critnib.h new file mode 100644 index 0000000000..b7ce850871 --- /dev/null +++ b/source/common/unified_malloc_framework/src/critnib/critnib.h @@ -0,0 +1,48 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + */ + +#ifndef CRITNIB_H +#define CRITNIB_H 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct critnib; +typedef struct critnib critnib; + +enum find_dir_t { + FIND_L = -2, + FIND_LE = -1, + FIND_EQ = 0, + FIND_GE = +1, + FIND_G = +2, +}; + +critnib *critnib_new(void); +void critnib_delete(critnib *c); + +int critnib_insert(critnib *c, uintptr_t key, void *value, int update); +void *critnib_remove(critnib *c, uintptr_t key); +void *critnib_get(critnib *c, uintptr_t key); +void *critnib_find_le(critnib *c, uintptr_t key); +int critnib_find(critnib *c, uintptr_t key, enum find_dir_t dir, + uintptr_t *rkey, void **rvalue); +void critnib_iter(critnib *c, uintptr_t min, uintptr_t max, + int (*func)(uintptr_t key, void *value, void *privdata), + void *privdata); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/common/unified_malloc_framework/src/critnib/pmdk-compat.h b/source/common/unified_malloc_framework/src/critnib/pmdk-compat.h new file mode 100644 index 0000000000..dd19062acf --- /dev/null +++ b/source/common/unified_malloc_framework/src/critnib/pmdk-compat.h @@ -0,0 +1,78 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + */ + +#include +#include +#include +#include + +typedef pthread_mutex_t os_mutex_t; + +#define Malloc malloc +#define Free free + +static void *Zalloc(size_t s) { + void *m = Malloc(s); + if (m) { + memset(m, 0, s); + } + return m; +} + +#define util_mutex_init(x) pthread_mutex_init(x, NULL) +#define util_mutex_destroy(x) pthread_mutex_destroy(x) +#define util_mutex_lock(x) pthread_mutex_lock(x) +#define util_mutex_unlock(x) pthread_mutex_unlock(x) +#define util_lssb_index64(x) ((unsigned char)__builtin_ctzll(x)) +#define util_mssb_index64(x) ((unsigned char)(63 - __builtin_clzll(x))) +#define util_lssb_index32(x) ((unsigned char)__builtin_ctzl(x)) +#define util_mssb_index32(x) ((unsigned char)(31 - __builtin_clzl(x))) +#if __SIZEOF_LONG__ == 8 +#define util_lssb_index(x) util_lssb_index64(x) +#define util_mssb_index(x) util_mssb_index64(x) +#else +#define util_lssb_index(x) util_lssb_index32(x) +#define util_mssb_index(x) util_mssb_index32(x) +#endif + +#define NOFUNCTION \ + do \ + ; \ + while (0) +#define VALGRIND_ANNOTATE_NEW_MEMORY(p, s) NOFUNCTION +#define VALGRIND_HG_DRD_DISABLE_CHECKING(p, s) NOFUNCTION + +#ifdef NDEBUG +#define ASSERT(x) NOFUNCTION +#define ASSERTne(x, y) ASSERT(x != y) +#else +#include +#define ASSERT(x) \ + do \ + if (!(x)) { \ + fprintf(stderr, \ + "Assertion failed: " #x " at " __FILE__ " line %d.\n", \ + __LINE__); \ + abort(); \ + } \ + while (0) +#define ASSERTne(x, y) \ + do { \ + long X = (x); \ + long Y = (y); \ + if (X == Y) { \ + fprintf(stderr, \ + "Assertion failed: " #x " != " #y \ + ", both are %ld, at " __FILE__ " line %d.\n", \ + X, __LINE__); \ + abort(); \ + } \ + } while (0) +#endif From c8a2d34cd00300246a63a9364a325d3de90d2b77 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Thu, 10 Aug 2023 22:03:25 +0000 Subject: [PATCH 014/145] [umf] replace memory tracker with a critnib-based impl This implementation is lock-free and does not require C++ runtime. --- .../unified_malloc_framework/CMakeLists.txt | 7 +- .../{memory_tracker.cpp => memory_tracker.c} | 152 ++++++++---------- .../src/memory_tracker.h | 4 +- .../src/memory_tracker_windows.cpp | 35 ++++ .../common/provider.c | 2 +- .../memoryProviderAPI.cpp | 3 +- 6 files changed, 115 insertions(+), 88 deletions(-) rename source/common/unified_malloc_framework/src/{memory_tracker.cpp => memory_tracker.c} (70%) create mode 100644 source/common/unified_malloc_framework/src/memory_tracker_windows.cpp diff --git a/source/common/unified_malloc_framework/CMakeLists.txt b/source/common/unified_malloc_framework/CMakeLists.txt index 15744605ec..384a83480b 100644 --- a/source/common/unified_malloc_framework/CMakeLists.txt +++ b/source/common/unified_malloc_framework/CMakeLists.txt @@ -6,10 +6,15 @@ set(UMF_SOURCES src/memory_pool.c src/memory_provider.c - src/memory_tracker.cpp + src/memory_tracker.c src/memory_provider_get_last_failed.cpp + src/critnib/critnib.c ) +if (MSVC) + set(UMF_SOURCES ${UMF_SOURCES} src/memory_tracker_windows.cpp) +endif() + if(UMF_BUILD_SHARED_LIBRARY) message(WARNING "Unified Malloc Framework is still an early work in progress." "There are no API/ABI backward compatibility guarantees. There will be breakages." diff --git a/source/common/unified_malloc_framework/src/memory_tracker.cpp b/source/common/unified_malloc_framework/src/memory_tracker.c similarity index 70% rename from source/common/unified_malloc_framework/src/memory_tracker.cpp rename to source/common/unified_malloc_framework/src/memory_tracker.c index adbe2aa5e9..55758adee9 100644 --- a/source/common/unified_malloc_framework/src/memory_tracker.cpp +++ b/source/common/unified_malloc_framework/src/memory_tracker.c @@ -9,112 +9,97 @@ */ #include "memory_tracker.h" +#include "critnib/critnib.h" + +#include #include #include -#include -#include -#include -#include +#include +#include #include -#ifdef _WIN32 -#include -#endif - -// TODO: reimplement in C and optimize... -struct umf_memory_tracker_t { - enum umf_result_t add(void *pool, const void *ptr, size_t size) { - std::unique_lock lock(mtx); +#if !defined(_WIN32) +critnib *TRACKER = NULL; +void __attribute__((constructor)) createLibTracker() { + TRACKER = critnib_new(); +} +void __attribute__((destructor)) deleteLibTracker() { critnib_delete(TRACKER); } - if (size == 0) { - return UMF_RESULT_SUCCESS; - } +umf_memory_tracker_handle_t umfMemoryTrackerGet(void) { + return (umf_memory_tracker_handle_t)TRACKER; +} +#endif - auto ret = - map.try_emplace(reinterpret_cast(ptr), size, pool); - return ret.second ? UMF_RESULT_SUCCESS : UMF_RESULT_ERROR_UNKNOWN; - } +struct tracker_value_t { + umf_memory_pool_handle_t pool; + size_t size; +}; - enum umf_result_t remove(const void *ptr, size_t size) { - std::unique_lock lock(mtx); +static enum umf_result_t +umfMemoryTrackerAdd(umf_memory_tracker_handle_t hTracker, + umf_memory_pool_handle_t pool, const void *ptr, + size_t size) { + assert(ptr); - map.erase(reinterpret_cast(ptr)); + struct tracker_value_t *value = + (struct tracker_value_t *)malloc(sizeof(struct tracker_value_t)); + value->pool = pool; + value->size = size; - // TODO: handle removing part of the range - (void)size; + int ret = critnib_insert((critnib *)hTracker, (uintptr_t)ptr, value, 0); + if (ret == 0) { return UMF_RESULT_SUCCESS; } - void *find(const void *ptr) { - std::shared_lock lock(mtx); - - auto intptr = reinterpret_cast(ptr); - auto it = map.upper_bound(intptr); - if (it == map.begin()) { - return nullptr; - } - - --it; - - auto address = it->first; - auto size = it->second.first; - auto pool = it->second.second; - - if (intptr >= address && intptr < address + size) { - return pool; - } + free(value); - return nullptr; + if (ret == ENOMEM) { + return UMF_RESULT_ERROR_OUT_OF_HOST_MEMORY; } - private: - std::shared_mutex mtx; - std::map> map; -}; - -static enum umf_result_t -umfMemoryTrackerAdd(umf_memory_tracker_handle_t hTracker, void *pool, - const void *ptr, size_t size) { - return hTracker->add(pool, ptr, size); + // This should not happen + // TODO: add logging here + return UMF_RESULT_ERROR_UNKNOWN; } static enum umf_result_t umfMemoryTrackerRemove(umf_memory_tracker_handle_t hTracker, const void *ptr, size_t size) { - return hTracker->remove(ptr, size); -} + assert(ptr); + + // TODO: there is no support for removing partial ranges (or multipe entires + // in a single remove call) yet. + // Every umfMemoryTrackerAdd(..., ptr, ...) should have a corresponsding + // umfMemoryTrackerRemove call with the same ptr value. + (void)size; + + void *value = critnib_remove((critnib *)hTracker, (uintptr_t)ptr); + if (!value) { + // This should not happen + // TODO: add logging here + return UMF_RESULT_ERROR_UNKNOWN; + } -extern "C" { + free(value); -#if defined(_WIN32) && defined(UMF_SHARED_LIBRARY) -umf_memory_tracker_t *tracker = nullptr; -BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - if (fdwReason == DLL_PROCESS_DETACH) { - delete tracker; - } else if (fdwReason == DLL_PROCESS_ATTACH) { - tracker = new umf_memory_tracker_t; - } - return TRUE; -} -#elif defined(_WIN32) -umf_memory_tracker_t trackerInstance; -umf_memory_tracker_t *tracker = &trackerInstance; -#else -umf_memory_tracker_t *tracker = nullptr; -void __attribute__((constructor)) createLibTracker() { - tracker = new umf_memory_tracker_t; + return UMF_RESULT_SUCCESS; } -void __attribute__((destructor)) deleteLibTracker() { delete tracker; } -#endif +umf_memory_pool_handle_t +umfMemoryTrackerGetPool(umf_memory_tracker_handle_t hTracker, const void *ptr) { + assert(ptr); -umf_memory_tracker_handle_t umfMemoryTrackerGet(void) { return tracker; } + uintptr_t rkey; + struct tracker_value_t *rvalue; + int found = critnib_find((critnib *)hTracker, (uintptr_t)ptr, FIND_LE, + (void *)&rkey, (void **)&rvalue); + if (!found) { + return NULL; + } -void *umfMemoryTrackerGetPool(umf_memory_tracker_handle_t hTracker, - const void *ptr) { - return hTracker->find(ptr); + return (rkey + rvalue->size >= (uintptr_t)ptr) ? rvalue->pool : NULL; } struct umf_tracking_memory_provider_t { @@ -136,7 +121,7 @@ static enum umf_result_t trackingAlloc(void *hProvider, size_t size, } ret = umfMemoryProviderAlloc(p->hUpstream, size, alignment, ptr); - if (ret != UMF_RESULT_SUCCESS) { + if (ret != UMF_RESULT_SUCCESS || !*ptr) { return ret; } @@ -159,9 +144,11 @@ static enum umf_result_t trackingFree(void *hProvider, void *ptr, size_t size) { // to avoid a race condition. If the order would be different, other thread // could allocate the memory at address `ptr` before a call to umfMemoryTrackerRemove // resulting in inconsistent state. - ret = umfMemoryTrackerRemove(p->hTracker, ptr, size); - if (ret != UMF_RESULT_SUCCESS) { - return ret; + if (ptr) { + ret = umfMemoryTrackerRemove(p->hTracker, ptr, size); + if (ret != UMF_RESULT_SUCCESS) { + return ret; + } } ret = umfMemoryProviderFree(p->hUpstream, ptr, size); @@ -267,4 +254,3 @@ void umfTrackingMemoryProviderGetUpstreamProvider( (umf_tracking_memory_provider_t *)hTrackingProvider; *hUpstream = p->hUpstream; } -} diff --git a/source/common/unified_malloc_framework/src/memory_tracker.h b/source/common/unified_malloc_framework/src/memory_tracker.h index 43a95cf0cd..c16844928e 100644 --- a/source/common/unified_malloc_framework/src/memory_tracker.h +++ b/source/common/unified_malloc_framework/src/memory_tracker.h @@ -22,8 +22,8 @@ extern "C" { typedef struct umf_memory_tracker_t *umf_memory_tracker_handle_t; umf_memory_tracker_handle_t umfMemoryTrackerGet(void); -void *umfMemoryTrackerGetPool(umf_memory_tracker_handle_t hTracker, - const void *ptr); +umf_memory_pool_handle_t +umfMemoryTrackerGetPool(umf_memory_tracker_handle_t hTracker, const void *ptr); // Creates a memory provider that tracks each allocation/deallocation through umf_memory_tracker_handle_t and // forwards all requests to hUpstream memory Provider. hUpstream lifetime should be managed by the user of this function. diff --git a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp new file mode 100644 index 0000000000..036883301e --- /dev/null +++ b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp @@ -0,0 +1,35 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + */ + +#include + +#if defined(UMF_SHARED_LIBRARY) +critnib *TRACKER = NULL; +BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + if (fdwReason == DLL_PROCESS_DETACH) { + critnib_delete(TRACKER); + } else if (fdwReason == DLL_PROCESS_ATTACH) { + TRACKER = critnib_new(); + } + return TRUE; +} +#else +struct tracker_t { + tracker_t() { map = critnib_new(); } + ~tracker_t() { critnib_remove(map); } + critnib *map; +}; +tracker_t TRACKER_INSTANCE; +critnib *TRACKER = TRACKER_INSTANCE.map; +#endif + +umf_memory_tracker_handle_t umfMemoryTrackerGet(void) { + return (umf_memory_tracker_handle_t)TRACKER; +} diff --git a/test/unified_malloc_framework/common/provider.c b/test/unified_malloc_framework/common/provider.c index 8f9e946bfc..303d8aea8d 100644 --- a/test/unified_malloc_framework/common/provider.c +++ b/test/unified_malloc_framework/common/provider.c @@ -23,7 +23,7 @@ static enum umf_result_t nullAlloc(void *provider, size_t size, (void)provider; (void)size; (void)alignment; - (void)ptr; + *ptr = NULL; return UMF_RESULT_SUCCESS; } diff --git a/test/unified_malloc_framework/memoryProviderAPI.cpp b/test/unified_malloc_framework/memoryProviderAPI.cpp index fa02f9eb99..02a7fa357d 100644 --- a/test/unified_malloc_framework/memoryProviderAPI.cpp +++ b/test/unified_malloc_framework/memoryProviderAPI.cpp @@ -23,7 +23,8 @@ TEST_F(test, memoryProviderTrace) { size_t call_count = 0; - auto ret = umfMemoryProviderAlloc(tracingProvider.get(), 0, 0, nullptr); + void *ptr; + auto ret = umfMemoryProviderAlloc(tracingProvider.get(), 0, 0, &ptr); ASSERT_EQ(ret, UMF_RESULT_SUCCESS); ASSERT_EQ(calls["alloc"], 1); ASSERT_EQ(calls.size(), ++call_count); From fe44f26f4d340cc4ae4a3ecfe95c5e647881442b Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Thu, 10 Aug 2023 23:19:51 +0000 Subject: [PATCH 015/145] [umf] add windows support to critnib Implement locks using C++ std::mutex and atomics by using Interlocked* functions and calling _ReadWriteBarrier --- .../unified_malloc_framework/CMakeLists.txt | 6 +- .../src/critnib/critnib.c | 45 +++++------ .../src/memory_tracker_windows.cpp | 5 +- .../{critnib/pmdk-compat.h => utils/utils.h} | 75 +++++++++++++------ .../src/utils/utils_posix.c | 35 +++++++++ .../src/utils/utils_windows.cpp | 33 ++++++++ 6 files changed, 154 insertions(+), 45 deletions(-) rename source/common/unified_malloc_framework/src/{critnib/pmdk-compat.h => utils/utils.h} (57%) create mode 100644 source/common/unified_malloc_framework/src/utils/utils_posix.c create mode 100644 source/common/unified_malloc_framework/src/utils/utils_windows.cpp diff --git a/source/common/unified_malloc_framework/CMakeLists.txt b/source/common/unified_malloc_framework/CMakeLists.txt index 384a83480b..a71b688b74 100644 --- a/source/common/unified_malloc_framework/CMakeLists.txt +++ b/source/common/unified_malloc_framework/CMakeLists.txt @@ -11,8 +11,10 @@ set(UMF_SOURCES src/critnib/critnib.c ) -if (MSVC) - set(UMF_SOURCES ${UMF_SOURCES} src/memory_tracker_windows.cpp) +if(MSVC) + set(UMF_SOURCES ${UMF_SOURCES} src/utils/utils_windows.cpp src/memory_tracker_windows.cpp) +else() + set(UMF_SOURCES ${UMF_SOURCES} src/utils/utils_posix.c) endif() if(UMF_BUILD_SHARED_LIBRARY) diff --git a/source/common/unified_malloc_framework/src/critnib/critnib.c b/source/common/unified_malloc_framework/src/critnib/critnib.c index 18b0e660c8..8a11a9c3f5 100644 --- a/source/common/unified_malloc_framework/src/critnib/critnib.c +++ b/source/common/unified_malloc_framework/src/critnib/critnib.c @@ -58,8 +58,8 @@ #include #include +#include "../utils/utils.h" #include "critnib.h" -#include "pmdk-compat.h" /* * A node that has been deleted is left untouched for this many delete @@ -126,25 +126,25 @@ struct critnib { uint64_t remove_count; - os_mutex_t mutex; /* writes/removes */ + struct os_mutex_t *mutex; /* writes/removes */ }; /* * atomic load */ static void load(void *src, void *dst) { - __atomic_load((word *)src, (word *)dst, memory_order_acquire); + util_atomic_load_acquire((word *)src, (word *)dst); } static void load64(uint64_t *src, uint64_t *dst) { - __atomic_load(src, dst, memory_order_acquire); + util_atomic_load_acquire(src, dst); } /* * atomic store */ static void store(void *dst, void *src) { - __atomic_store_n((word *)dst, (word)src, memory_order_release); + util_atomic_store_release((word *)dst, (word)src); } /* @@ -181,7 +181,11 @@ struct critnib *critnib_new(void) { return NULL; } - util_mutex_init(&c->mutex); + c->mutex = util_mutex_create(); + if (!c->mutex) { + free(c); + return NULL; + } VALGRIND_HG_DRD_DISABLE_CHECKING(&c->root, sizeof(c->root)); VALGRIND_HG_DRD_DISABLE_CHECKING(&c->remove_count, sizeof(c->remove_count)); @@ -214,7 +218,7 @@ void critnib_delete(struct critnib *c) { delete_node(c->root); } - util_mutex_destroy(&c->mutex); + util_mutex_destroy(c->mutex); for (struct critnib_node *m = c->deleted_node; m;) { struct critnib_node *mm = m->child[0]; @@ -313,11 +317,11 @@ static struct critnib_leaf *alloc_leaf(struct critnib *__restrict c) { * Takes a global write lock but doesn't stall any readers. */ int critnib_insert(struct critnib *c, word key, void *value, int update) { - util_mutex_lock(&c->mutex); + util_mutex_lock(c->mutex); struct critnib_leaf *k = alloc_leaf(c); if (!k) { - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return ENOMEM; } @@ -333,7 +337,7 @@ int critnib_insert(struct critnib *c, word key, void *value, int update) { if (!n) { c->root = kn; - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return 0; } @@ -351,7 +355,7 @@ int critnib_insert(struct critnib *c, word key, void *value, int update) { n = prev; store(&n->child[slice_index(key, n->shift)], kn); - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return 0; } @@ -365,10 +369,10 @@ int critnib_insert(struct critnib *c, word key, void *value, int update) { if (update) { to_leaf(n)->value = value; - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return 0; } else { - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return EEXIST; } } @@ -380,7 +384,7 @@ int critnib_insert(struct critnib *c, word key, void *value, int update) { if (!m) { free_leaf(c, to_leaf(kn)); - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return ENOMEM; } @@ -396,7 +400,7 @@ int critnib_insert(struct critnib *c, word key, void *value, int update) { m->path = key & path_mask(sh); store(parent, m); - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return 0; } @@ -408,15 +412,14 @@ void *critnib_remove(struct critnib *c, word key) { struct critnib_leaf *k; void *value = NULL; - util_mutex_lock(&c->mutex); + util_mutex_lock(c->mutex); struct critnib_node *n = c->root; if (!n) { goto not_found; } - word del = __atomic_fetch_add(&c->remove_count, 1, __ATOMIC_ACQ_REL) % - DELETED_LIFE; + word del = (util_atomic_increment(&c->remove_count) - 1) % DELETED_LIFE; free_node(c, c->pending_del_nodes[del]); free_leaf(c, c->pending_del_leaves[del]); c->pending_del_nodes[del] = NULL; @@ -479,7 +482,7 @@ void *critnib_remove(struct critnib *c, word key) { c->pending_del_leaves[del] = k; not_found: - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); return value; } @@ -802,9 +805,9 @@ static int iter(struct critnib_node *__restrict n, word min, word max, void critnib_iter(critnib *c, uintptr_t min, uintptr_t max, int (*func)(uintptr_t key, void *value, void *privdata), void *privdata) { - util_mutex_lock(&c->mutex); + util_mutex_lock(c->mutex); if (c->root) { iter(c->root, min, max, func, privdata); } - util_mutex_unlock(&c->mutex); + util_mutex_unlock(c->mutex); } diff --git a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp index 036883301e..74cfec7e42 100644 --- a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp +++ b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp @@ -8,6 +8,9 @@ * */ +#include "critnib/critnib.h" +#include "memory_tracker.h" + #include #if defined(UMF_SHARED_LIBRARY) @@ -23,7 +26,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { #else struct tracker_t { tracker_t() { map = critnib_new(); } - ~tracker_t() { critnib_remove(map); } + ~tracker_t() { critnib_delete(map); } critnib *map; }; tracker_t TRACKER_INSTANCE; diff --git a/source/common/unified_malloc_framework/src/critnib/pmdk-compat.h b/source/common/unified_malloc_framework/src/utils/utils.h similarity index 57% rename from source/common/unified_malloc_framework/src/critnib/pmdk-compat.h rename to source/common/unified_malloc_framework/src/utils/utils.h index dd19062acf..ce1da38601 100644 --- a/source/common/unified_malloc_framework/src/critnib/pmdk-compat.h +++ b/source/common/unified_malloc_framework/src/utils/utils.h @@ -8,17 +8,63 @@ * */ -#include -#include +#include #include #include +#if defined(_WIN32) +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct os_mutex_t; + +struct os_mutex_t *util_mutex_create(void); +void util_mutex_destroy(struct os_mutex_t *mutex); +int util_mutex_lock(struct os_mutex_t *mutex); +int util_mutex_unlock(struct os_mutex_t *mutex); + +#if defined(_WIN32) +static __inline unsigned char util_lssb_index(long long value) { + unsigned long ret; + _BitScanForward64(&ret, value); + return (unsigned char)ret; +} +static __inline unsigned char util_mssb_index(long long value) { + unsigned long ret; + _BitScanReverse64(&ret, value); + return (unsigned char)ret; +} -typedef pthread_mutex_t os_mutex_t; +// There is no good way to do atomic_load on windows... +#define util_atomic_load_acquire(object, dest) \ + do { \ + *dest = InterlockedOr64Acquire((LONG64 volatile *)dest, 0); \ + } while (0) + +#define util_atomic_store_release(object, desired) \ + InterlockedExchange64((LONG64 volatile *)object, (LONG64)desired) +#define util_atomic_increment(object) \ + InterlockedIncrement64((LONG64 volatile *)object) +#else +#define util_lssb_index(x) ((unsigned char)__builtin_ctzll(x)) +#define util_mssb_index(x) ((unsigned char)(63 - __builtin_clzll(x))) +#define util_atomic_load_acquire(object, dest) \ + __atomic_load(object, dest, memory_order_acquire) +#define util_atomic_store_release(object, desired) \ + __atomic_store_n(object, desired, memory_order_release) +#define util_atomic_increment(object) \ + __atomic_add_fetch(object, 1, __ATOMIC_ACQ_REL) +#endif #define Malloc malloc #define Free free -static void *Zalloc(size_t s) { +static inline void *Zalloc(size_t s) { void *m = Malloc(s); if (m) { memset(m, 0, s); @@ -26,22 +72,6 @@ static void *Zalloc(size_t s) { return m; } -#define util_mutex_init(x) pthread_mutex_init(x, NULL) -#define util_mutex_destroy(x) pthread_mutex_destroy(x) -#define util_mutex_lock(x) pthread_mutex_lock(x) -#define util_mutex_unlock(x) pthread_mutex_unlock(x) -#define util_lssb_index64(x) ((unsigned char)__builtin_ctzll(x)) -#define util_mssb_index64(x) ((unsigned char)(63 - __builtin_clzll(x))) -#define util_lssb_index32(x) ((unsigned char)__builtin_ctzl(x)) -#define util_mssb_index32(x) ((unsigned char)(31 - __builtin_clzl(x))) -#if __SIZEOF_LONG__ == 8 -#define util_lssb_index(x) util_lssb_index64(x) -#define util_mssb_index(x) util_mssb_index64(x) -#else -#define util_lssb_index(x) util_lssb_index32(x) -#define util_mssb_index(x) util_mssb_index32(x) -#endif - #define NOFUNCTION \ do \ ; \ @@ -53,7 +83,6 @@ static void *Zalloc(size_t s) { #define ASSERT(x) NOFUNCTION #define ASSERTne(x, y) ASSERT(x != y) #else -#include #define ASSERT(x) \ do \ if (!(x)) { \ @@ -76,3 +105,7 @@ static void *Zalloc(size_t s) { } \ } while (0) #endif + +#ifdef __cplusplus +} +#endif diff --git a/source/common/unified_malloc_framework/src/utils/utils_posix.c b/source/common/unified_malloc_framework/src/utils/utils_posix.c new file mode 100644 index 0000000000..7cbefff1c8 --- /dev/null +++ b/source/common/unified_malloc_framework/src/utils/utils_posix.c @@ -0,0 +1,35 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + */ + +#include +#include + +#include "utils.h" + +struct os_mutex_t *util_mutex_create() { + pthread_mutex_t *mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); + int ret = pthread_mutex_init(mutex, NULL); + return ret == 0 ? ((struct os_mutex_t *)mutex) : NULL; +} + +void util_mutex_destroy(struct os_mutex_t *m) { + pthread_mutex_t *mutex = (pthread_mutex_t *)m; + int ret = pthread_mutex_destroy(mutex); + (void)ret; // TODO: add logging + free(m); +} + +int util_mutex_lock(struct os_mutex_t *m) { + return pthread_mutex_lock((pthread_mutex_t *)m); +} + +int util_mutex_unlock(struct os_mutex_t *m) { + return pthread_mutex_unlock((pthread_mutex_t *)m); +} diff --git a/source/common/unified_malloc_framework/src/utils/utils_windows.cpp b/source/common/unified_malloc_framework/src/utils/utils_windows.cpp new file mode 100644 index 0000000000..b5db557c77 --- /dev/null +++ b/source/common/unified_malloc_framework/src/utils/utils_windows.cpp @@ -0,0 +1,33 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + */ + +#include + +#include "utils.h" + +struct os_mutex_t *util_mutex_create(void) { + return reinterpret_cast(new std::mutex); +} + +void util_mutex_destroy(struct os_mutex_t *mutex) { + delete reinterpret_cast(mutex); +} + +int util_mutex_lock(struct os_mutex_t *mutex) try { + reinterpret_cast(mutex)->lock(); + return 0; +} catch (std::system_error &err) { + return err.code().value(); +} + +int util_mutex_unlock(struct os_mutex_t *mutex) { + reinterpret_cast(mutex)->unlock(); + return 0; +} From 845357b7a2e8ea1ca7431582314bdfca3c171728 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Wed, 6 Sep 2023 09:58:38 +0100 Subject: [PATCH 016/145] [UR] Fix program CTS assesion checks --- .../program/urProgramGetBuildInfo.cpp | 16 ++++++++++------ test/conformance/program/urProgramGetInfo.cpp | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/test/conformance/program/urProgramGetBuildInfo.cpp b/test/conformance/program/urProgramGetBuildInfo.cpp index 59eccd4a65..ddc0ff998c 100644 --- a/test/conformance/program/urProgramGetBuildInfo.cpp +++ b/test/conformance/program/urProgramGetBuildInfo.cpp @@ -36,17 +36,21 @@ TEST_P(urProgramGetBuildInfoTest, Success) { TEST_P(urProgramGetBuildInfoTest, InvalidNullHandleProgram) { ur_program_build_status_t programBuildStatus = UR_PROGRAM_BUILD_STATUS_ERROR; - ASSERT_SUCCESS(urProgramGetBuildInfo( - nullptr, device, UR_PROGRAM_BUILD_INFO_STATUS, - sizeof(programBuildStatus), &programBuildStatus, nullptr)); + ASSERT_EQ_RESULT(urProgramGetBuildInfo(nullptr, device, + UR_PROGRAM_BUILD_INFO_STATUS, + sizeof(programBuildStatus), + &programBuildStatus, nullptr), + UR_RESULT_ERROR_INVALID_NULL_HANDLE); } TEST_P(urProgramGetBuildInfoTest, InvalidNullHandleDevice) { ur_program_build_status_t programBuildStatus = UR_PROGRAM_BUILD_STATUS_ERROR; - ASSERT_SUCCESS(urProgramGetBuildInfo( - program, nullptr, UR_PROGRAM_BUILD_INFO_STATUS, - sizeof(programBuildStatus), &programBuildStatus, nullptr)); + ASSERT_EQ_RESULT(urProgramGetBuildInfo(program, nullptr, + UR_PROGRAM_BUILD_INFO_STATUS, + sizeof(programBuildStatus), + &programBuildStatus, nullptr), + UR_RESULT_ERROR_INVALID_NULL_HANDLE); } TEST_P(urProgramGetBuildInfoTest, InvalidEnumeration) { diff --git a/test/conformance/program/urProgramGetInfo.cpp b/test/conformance/program/urProgramGetInfo.cpp index 8e18dc7b87..ebe840bee0 100644 --- a/test/conformance/program/urProgramGetInfo.cpp +++ b/test/conformance/program/urProgramGetInfo.cpp @@ -29,8 +29,9 @@ TEST_P(urProgramGetInfoTest, Success) { TEST_P(urProgramGetInfoTest, InvalidNullHandleProgram) { uint32_t ref_count = 0; - ASSERT_SUCCESS(urProgramGetInfo(nullptr, UR_PROGRAM_INFO_REFERENCE_COUNT, - sizeof(ref_count), &ref_count, nullptr)); + ASSERT_EQ_RESULT(urProgramGetInfo(nullptr, UR_PROGRAM_INFO_REFERENCE_COUNT, + sizeof(ref_count), &ref_count, nullptr), + UR_RESULT_ERROR_INVALID_NULL_HANDLE); } TEST_P(urProgramGetInfoTest, InvalidEnumeration) { From 2c533e6a777a7affa5b3f69f994e53f26e794a6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio?= Date: Thu, 7 Sep 2023 17:32:48 +0100 Subject: [PATCH 017/145] Update specification for urEnqueue entrypoints (#851) - Added extra conditions to the validation layers of urEnqueueMemBufferFill, urEnqueueMemImageCopy, urEnqueueMemImageWrite and urEnqueueMemImageReady --- include/ur_api.h | 11 +++++++ scripts/core/enqueue.yml | 11 +++++++ source/loader/layers/validation/ur_valddi.cpp | 32 +++++++++++++++++++ source/loader/ur_libapi.cpp | 11 +++++++ source/ur_api.cpp | 11 +++++++ 5 files changed, 76 insertions(+) diff --git a/include/ur_api.h b/include/ur_api.h index 258ea85e7a..141615ba1e 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -6217,6 +6217,11 @@ urEnqueueMemBufferCopyRect( /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + `offset % patternSize != 0` /// + If `offset + size` results in an out-of-bounds access. /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES @@ -6266,6 +6271,8 @@ urEnqueueMemBufferFill( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL @@ -6317,6 +6324,8 @@ urEnqueueMemImageRead( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL @@ -6362,6 +6371,8 @@ urEnqueueMemImageWrite( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL diff --git a/scripts/core/enqueue.yml b/scripts/core/enqueue.yml index aef1d8023b..67a3adbee6 100644 --- a/scripts/core/enqueue.yml +++ b/scripts/core/enqueue.yml @@ -571,6 +571,11 @@ returns: - "If event objects in phEventWaitList are not valid events." - $X_RESULT_ERROR_INVALID_MEM_OBJECT - $X_RESULT_ERROR_INVALID_SIZE: + - "`patternSize == 0 || size == 0`" + - "`patternSize > size`" + - "`(patternSize & (patternSize - 1)) != 0`" + - "`size % patternSize != 0`" + - "`offset % patternSize != 0`" - "If `offset + size` results in an out-of-bounds access." - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - $X_RESULT_ERROR_OUT_OF_RESOURCES @@ -629,6 +634,8 @@ returns: - "`phEventWaitList != NULL && numEventsInWaitList == 0`" - "If event objects in phEventWaitList are not valid events." - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`region.width == 0 || region.height == 0 || region.depth == 0`" - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- @@ -686,6 +693,8 @@ returns: - "`phEventWaitList != NULL && numEventsInWaitList == 0`" - "If event objects in phEventWaitList are not valid events." - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`region.width == 0 || region.height == 0 || region.depth == 0`" - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- @@ -735,6 +744,8 @@ returns: - "`phEventWaitList != NULL && numEventsInWaitList == 0`" - "If event objects in phEventWaitList are not valid events." - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`region.width == 0 || region.height == 0 || region.depth == 0`" - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 2e36eeeb2c..5df41be123 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -4525,6 +4525,26 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (patternSize == 0 || size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (patternSize > size) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if ((patternSize & (patternSize - 1)) != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (size % patternSize != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if (offset % patternSize != 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } } ur_result_t result = @@ -4584,6 +4604,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (region.width == 0 || region.height == 0 || region.depth == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } } ur_result_t result = pfnMemImageRead( @@ -4644,6 +4668,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (region.width == 0 || region.height == 0 || region.depth == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } } ur_result_t result = pfnMemImageWrite( @@ -4704,6 +4732,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (region.width == 0 || region.height == 0 || region.depth == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } } ur_result_t result = diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 5d0b64d922..9558288694 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -5197,6 +5197,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + `offset % patternSize != 0` /// + If `offset + size` results in an out-of-bounds access. /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES @@ -5259,6 +5264,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferFill( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageRead( @@ -5324,6 +5331,8 @@ ur_result_t UR_APICALL urEnqueueMemImageRead( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageWrite( @@ -5385,6 +5394,8 @@ ur_result_t UR_APICALL urEnqueueMemImageWrite( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageCopy( diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 1d6371781b..4289b0fc53 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -4405,6 +4405,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `patternSize == 0 || size == 0` +/// + `patternSize > size` +/// + `(patternSize & (patternSize - 1)) != 0` +/// + `size % patternSize != 0` +/// + `offset % patternSize != 0` /// + If `offset + size` results in an out-of-bounds access. /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES @@ -4458,6 +4463,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferFill( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageRead( @@ -4515,6 +4522,8 @@ ur_result_t UR_APICALL urEnqueueMemImageRead( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageWrite( @@ -4567,6 +4576,8 @@ ur_result_t UR_APICALL urEnqueueMemImageWrite( /// + `phEventWaitList != NULL && numEventsInWaitList == 0` /// + If event objects in phEventWaitList are not valid events. /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `region.width == 0 || region.height == 0 || region.depth == 0` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageCopy( From 065edc1d46f216ae3987d45fb0e1c277175475a5 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 11 Sep 2023 13:45:40 +0100 Subject: [PATCH 018/145] [umf] Fix macOS build The AppleClang compiler emits warnings in C functions with zero arguments that are not specified as `f(void)`. --- source/common/unified_malloc_framework/src/memory_tracker.c | 6 ++++-- .../common/unified_malloc_framework/src/utils/utils_posix.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/source/common/unified_malloc_framework/src/memory_tracker.c b/source/common/unified_malloc_framework/src/memory_tracker.c index 55758adee9..76b0b7b745 100644 --- a/source/common/unified_malloc_framework/src/memory_tracker.c +++ b/source/common/unified_malloc_framework/src/memory_tracker.c @@ -21,10 +21,12 @@ #if !defined(_WIN32) critnib *TRACKER = NULL; -void __attribute__((constructor)) createLibTracker() { +void __attribute__((constructor)) createLibTracker(void) { TRACKER = critnib_new(); } -void __attribute__((destructor)) deleteLibTracker() { critnib_delete(TRACKER); } +void __attribute__((destructor)) deleteLibTracker(void) { + critnib_delete(TRACKER); +} umf_memory_tracker_handle_t umfMemoryTrackerGet(void) { return (umf_memory_tracker_handle_t)TRACKER; diff --git a/source/common/unified_malloc_framework/src/utils/utils_posix.c b/source/common/unified_malloc_framework/src/utils/utils_posix.c index 7cbefff1c8..d03bb366a1 100644 --- a/source/common/unified_malloc_framework/src/utils/utils_posix.c +++ b/source/common/unified_malloc_framework/src/utils/utils_posix.c @@ -13,7 +13,7 @@ #include "utils.h" -struct os_mutex_t *util_mutex_create() { +struct os_mutex_t *util_mutex_create(void) { pthread_mutex_t *mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); int ret = pthread_mutex_init(mutex, NULL); return ret == 0 ? ((struct os_mutex_t *)mutex) : NULL; From 017c99839f323d1d58eb461b199d814adf9335ba Mon Sep 17 00:00:00 2001 From: Isaac Ault Date: Fri, 8 Sep 2023 09:12:51 +0100 Subject: [PATCH 019/145] Create layered image properties struct. --- include/ur.py | 16 +++++ include/ur_api.h | 96 ++++++++++++++++------------ scripts/core/EXP-BINDLESS-IMAGES.rst | 4 ++ scripts/core/exp-bindless-images.yml | 17 +++++ source/common/ur_params.hpp | 35 ++++++++++ 5 files changed, 128 insertions(+), 40 deletions(-) diff --git a/include/ur.py b/include/ur.py index 0a43f828ae..c6ce722221 100644 --- a/include/ur.py +++ b/include/ur.py @@ -247,6 +247,7 @@ class ur_structure_type_v(IntEnum): EXP_INTEROP_SEMAPHORE_DESC = 0x2002 ## ::ur_exp_interop_semaphore_desc_t EXP_FILE_DESCRIPTOR = 0x2003 ## ::ur_exp_file_descriptor_t EXP_WIN32_HANDLE = 0x2004 ## ::ur_exp_win32_handle_t + EXP_LAYERED_IMAGE_PROPERTIES = 0x2005 ## ::ur_exp_layered_image_properties_t class ur_structure_type_t(c_int): def __str__(self): @@ -2231,6 +2232,21 @@ class ur_exp_interop_semaphore_desc_t(Structure): ("pNext", c_void_p) ## [in][optional] pointer to extension-specific structure ] +############################################################################### +## @brief Describes layered image properties +## +## @details +## - Specify these properties in ::urBindlessImagesUnsampledImageCreateExp +## or ::urBindlessImagesSampledImageCreateExp via ::ur_image_desc_t as +## part of a `pNext` chain. +class ur_exp_layered_image_properties_t(Structure): + _fields_ = [ + ("stype", ur_structure_type_t), ## [in] type of this structure, must be + ## ::UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES + ("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure + ("numLayers", c_ulong) ## [in] number of layers the image should have + ] + ############################################################################### ## @brief The extension string which defines support for command-buffers which ## is returned when querying device extensions. diff --git a/include/ur_api.h b/include/ur_api.h index 141615ba1e..389bd183f3 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -216,46 +216,47 @@ typedef enum ur_function_t { /////////////////////////////////////////////////////////////////////////////// /// @brief Defines structure types typedef enum ur_structure_type_t { - UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES = 0, ///< ::ur_context_properties_t - UR_STRUCTURE_TYPE_IMAGE_DESC = 1, ///< ::ur_image_desc_t - UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, ///< ::ur_buffer_properties_t - UR_STRUCTURE_TYPE_BUFFER_REGION = 3, ///< ::ur_buffer_region_t - UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, ///< ::ur_buffer_channel_properties_t - UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, ///< ::ur_buffer_alloc_location_properties_t - UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, ///< ::ur_program_properties_t - UR_STRUCTURE_TYPE_USM_DESC = 7, ///< ::ur_usm_desc_t - UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, ///< ::ur_usm_host_desc_t - UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, ///< ::ur_usm_device_desc_t - UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, ///< ::ur_usm_pool_desc_t - UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, ///< ::ur_usm_pool_limits_desc_t - UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, ///< ::ur_device_binary_t - UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, ///< ::ur_sampler_desc_t - UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, ///< ::ur_queue_properties_t - UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, ///< ::ur_queue_index_properties_t - UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, ///< ::ur_context_native_properties_t - UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, ///< ::ur_kernel_native_properties_t - UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, ///< ::ur_queue_native_properties_t - UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, ///< ::ur_mem_native_properties_t - UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, ///< ::ur_event_native_properties_t - UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, ///< ::ur_platform_native_properties_t - UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, ///< ::ur_device_native_properties_t - UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, ///< ::ur_program_native_properties_t - UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, ///< ::ur_sampler_native_properties_t - UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, ///< ::ur_queue_native_desc_t - UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, ///< ::ur_device_partition_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, ///< ::ur_kernel_arg_mem_obj_properties_t - UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, ///< ::ur_physical_mem_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, ///< ::ur_kernel_arg_pointer_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, ///< ::ur_kernel_arg_sampler_properties_t - UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, ///< ::ur_kernel_exec_info_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, ///< ::ur_kernel_arg_value_properties_t - UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t - UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t - UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t - UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t - UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_t - UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t - UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t + UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES = 0, ///< ::ur_context_properties_t + UR_STRUCTURE_TYPE_IMAGE_DESC = 1, ///< ::ur_image_desc_t + UR_STRUCTURE_TYPE_BUFFER_PROPERTIES = 2, ///< ::ur_buffer_properties_t + UR_STRUCTURE_TYPE_BUFFER_REGION = 3, ///< ::ur_buffer_region_t + UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES = 4, ///< ::ur_buffer_channel_properties_t + UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES = 5, ///< ::ur_buffer_alloc_location_properties_t + UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES = 6, ///< ::ur_program_properties_t + UR_STRUCTURE_TYPE_USM_DESC = 7, ///< ::ur_usm_desc_t + UR_STRUCTURE_TYPE_USM_HOST_DESC = 8, ///< ::ur_usm_host_desc_t + UR_STRUCTURE_TYPE_USM_DEVICE_DESC = 9, ///< ::ur_usm_device_desc_t + UR_STRUCTURE_TYPE_USM_POOL_DESC = 10, ///< ::ur_usm_pool_desc_t + UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC = 11, ///< ::ur_usm_pool_limits_desc_t + UR_STRUCTURE_TYPE_DEVICE_BINARY = 12, ///< ::ur_device_binary_t + UR_STRUCTURE_TYPE_SAMPLER_DESC = 13, ///< ::ur_sampler_desc_t + UR_STRUCTURE_TYPE_QUEUE_PROPERTIES = 14, ///< ::ur_queue_properties_t + UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES = 15, ///< ::ur_queue_index_properties_t + UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES = 16, ///< ::ur_context_native_properties_t + UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES = 17, ///< ::ur_kernel_native_properties_t + UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES = 18, ///< ::ur_queue_native_properties_t + UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES = 19, ///< ::ur_mem_native_properties_t + UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES = 20, ///< ::ur_event_native_properties_t + UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES = 21, ///< ::ur_platform_native_properties_t + UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES = 22, ///< ::ur_device_native_properties_t + UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES = 23, ///< ::ur_program_native_properties_t + UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES = 24, ///< ::ur_sampler_native_properties_t + UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC = 25, ///< ::ur_queue_native_desc_t + UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES = 26, ///< ::ur_device_partition_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES = 27, ///< ::ur_kernel_arg_mem_obj_properties_t + UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES = 28, ///< ::ur_physical_mem_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES = 29, ///< ::ur_kernel_arg_pointer_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES = 30, ///< ::ur_kernel_arg_sampler_properties_t + UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES = 31, ///< ::ur_kernel_exec_info_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES = 32, ///< ::ur_kernel_arg_value_properties_t + UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES = 33, ///< ::ur_kernel_arg_local_properties_t + UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC = 0x1000, ///< ::ur_exp_command_buffer_desc_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES = 0x2000, ///< ::ur_exp_sampler_mip_properties_t + UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC = 0x2001, ///< ::ur_exp_interop_mem_desc_t + UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC = 0x2002, ///< ::ur_exp_interop_semaphore_desc_t + UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t + UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t + UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES = 0x2005, ///< ::ur_exp_layered_image_properties_t /// @cond UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -7026,6 +7027,21 @@ typedef struct ur_exp_interop_semaphore_desc_t { } ur_exp_interop_semaphore_desc_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes layered image properties +/// +/// @details +/// - Specify these properties in ::urBindlessImagesUnsampledImageCreateExp +/// or ::urBindlessImagesSampledImageCreateExp via ::ur_image_desc_t as +/// part of a `pNext` chain. +typedef struct ur_exp_layered_image_properties_t { + ur_structure_type_t stype; ///< [in] type of this structure, must be + ///< ::UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES + void *pNext; ///< [in,out][optional] pointer to extension-specific structure + uint32_t numLayers; ///< [in] number of layers the image should have + +} ur_exp_layered_image_properties_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief USM allocate pitched memory /// diff --git a/scripts/core/EXP-BINDLESS-IMAGES.rst b/scripts/core/EXP-BINDLESS-IMAGES.rst index 071fe799fd..03a31537f3 100644 --- a/scripts/core/EXP-BINDLESS-IMAGES.rst +++ b/scripts/core/EXP-BINDLESS-IMAGES.rst @@ -68,6 +68,7 @@ Enums ${X}_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC ${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR ${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE + ${X}_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES * ${x}_device_info_t * ${X}_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP @@ -127,6 +128,7 @@ Types * ${x}_exp_interop_semaphore_desc_t * ${x}_exp_file_descriptor_t * ${x}_exp_win32_handle_t +* ${x}_exp_layered_image_properties_t Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -176,6 +178,8 @@ Changelog +----------+-------------------------------------------------------------+ | 6.0 | Fix semaphore import function parameter name. | +----------+-------------------------------------------------------------+ +| 7.0 | Add layered image properties struct. | ++----------+-------------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index 846e97ac61..ef18244a6d 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -107,6 +107,9 @@ etors: - name: EXP_WIN32_HANDLE desc: $x_exp_win32_handle_t value: "0x2004" + - name: EXP_LAYERED_IMAGE_PROPERTIES + desc: $x_exp_layered_image_properties_t + value: "0x2005" --- #-------------------------------------------------------------------------- type: enum extend: true @@ -186,6 +189,20 @@ name: $x_exp_interop_semaphore_desc_t base: $x_base_desc_t members: [] --- #-------------------------------------------------------------------------- +type: struct +desc: "Describes layered image properties" +details: + - Specify these properties in $xBindlessImagesUnsampledImageCreateExp or + $xBindlessImagesSampledImageCreateExp via $x_image_desc_t as part of a + `pNext` chain. +class: $xBindlessImages +name: $x_exp_layered_image_properties_t +base: $x_base_properties_t +members: + - type: uint32_t + name: numLayers + desc: "[in] number of layers the image should have" +--- #-------------------------------------------------------------------------- type: function desc: "USM allocate pitched memory" class: $xUSM diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 3ee474d105..04a4636444 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -438,6 +438,9 @@ inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_interop_semaphore_desc_t params); inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_layered_image_properties_t params); +inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_exp_peer_info_t value); @@ -1318,6 +1321,10 @@ inline std::ostream &operator<<(std::ostream &os, case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: os << "UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE"; break; + + case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: + os << "UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES"; + break; default: os << "unknown enumerator"; break; @@ -1566,6 +1573,12 @@ inline void serializeStruct(std::ostream &os, const void *ptr) { (const ur_exp_win32_handle_t *)ptr; ur_params::serializePtr(os, pstruct); } break; + + case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: { + const ur_exp_layered_image_properties_t *pstruct = + (const ur_exp_layered_image_properties_t *)ptr; + ur_params::serializePtr(os, pstruct); + } break; default: os << "unknown enumerator"; break; @@ -9892,6 +9905,28 @@ operator<<(std::ostream &os, return os; } inline std::ostream & +operator<<(std::ostream &os, + const struct ur_exp_layered_image_properties_t params) { + os << "(struct ur_exp_layered_image_properties_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur_params::serializeStruct(os, (params.pNext)); + + os << ", "; + os << ".numLayers = "; + + os << (params.numLayers); + + os << "}"; + return os; +} +inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { os << "(struct ur_exp_command_buffer_desc_t){"; From 8edc7e2b7f644b93fb71c7bd68597647684b023c Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Tue, 22 Aug 2023 11:32:58 +0100 Subject: [PATCH 020/145] Add initial CUDA and HIP usage guides --- scripts/core/CUDA.rst | 159 +++++++++++++++++++++++++++++++ scripts/core/HIP.rst | 95 ++++++++++++++++++ scripts/templates/index.rst.mako | 2 + 3 files changed, 256 insertions(+) create mode 100644 scripts/core/CUDA.rst create mode 100644 scripts/core/HIP.rst diff --git a/scripts/core/CUDA.rst b/scripts/core/CUDA.rst new file mode 100644 index 0000000000..52b68c010f --- /dev/null +++ b/scripts/core/CUDA.rst @@ -0,0 +1,159 @@ +<% + OneApi=tags['$OneApi'] + x=tags['$x'] + X=x.upper() +%> + +========================== +CUDA UR Reference Document +========================== + +This document gives general guidelines of how to use UR to load and build +programs, and execute kernels on a CUDA device. + +Device code +=========== + +A CUDA device image may be made of PTX and/or SASS, two different kinds of +device code for NVIDIA GPUs. + +CUDA device images can be generated by a CUDA-capable compiler toolchain. Most +CUDA compiler toolchains are capable of generating PTX, SASS and/or bundles of +PTX and SASS. + +PTX +--- + +PTX is a high level NVIDIA ISA which can be JIT compiled at runtime by the CUDA +driver. In UR, this JIT compilation happens at ${x}ProgramBuild, where PTX is +assembled into device specific SASS which then can run on device. + +PTX is forward compatible, so PTX generated for ``.target sm_52`` will be JIT +compiled without issue for devices with a greater compute capability than +``sm_52``. Whereas PTX generated for ``sm_80`` cannot be JIT compiled for an +``sm_60`` device. + +An advantage of using PTX over SASS is that one code can run on multiple +devices. However, PTX generated for an older arch may not give access to newer +hardware instructions, such as new atomic operations, or tensor core +instructions. + +JIT compilation has some overhead at ${x}ProgramBuild, especially if the program +that is being loaded contains multiple kernels. The ``ptxjitcompiler`` keeps a +JIT cache, however, so this overhead is only paid the first time that a program +is built. JIT caching may be turned off by setting the environment variable +``CUDA_CACHE_DISABLE=1``. + +SASS +---- + +SASS is a device specific binary which may be produced by ``ptxas`` or some +other tool. SASS is specific to an individual arch and is not portable across +arches. + +A SASS file may be stored as a ``.cubin`` file by NVIDIA tools. + +UR Programs +=========== + +A ${x}_program_handle_t has a one to one mapping with the CUDA driver object +`CUModule `_. + +In UR for CUDA, a ${x}_program_handle_t can be created using +${x}ProgramCreateWithBinary with: + +* A single PTX module, stored as a null terminated ``uint8_t`` buffer. +* A single SASS module, stored as an opaque ``uint8_t`` buffer. +* A mixed PTX/SASS module, where the SASS module is the assembled PTX module. + +A ${x}_program_handle_t is valid only for a single architecture. If a CUDA +compatible binary contains device code for multiple NVIDIA architectures, it is +the user's responsibility to split these separate device images so that +${x}ProgramCreateWithBinary is only called with a device binary for a single +device arch. + +If a program is large and contains many kernels, loading and/or JIT compiling +the program may have a high overhead. This can be mitigated by splitting a +program into multiple smaller programs (corresponding to PTX/SASS files). In +this way, an application will only pay the overhead of loading/compiling +kernels that it will likely use. + +Using PTX Modules in UR +----------------------- + +A PTX module will be loaded and JIT compiled for the necessary architecture at +${x}ProgramBuild. If the PTX module has been generated for a compute capability +greater than the compute capability of the device, then ${x}ProgramBuild will +fail with the error ``CUDA_ERROR_NO_BINARY_FOR_GPU``. + +A PTX module passed to ${x}ProgramBuild must contain only one PTX file. +Separate PTX files are to be handled separately. + +Arguments may be passed to the ``ptxjitcompiler`` via ${x}ProgramBuild. +Currently ``maxrregcount`` is the only supported argument. + +.. parsed-literal:: + + ${x}ProgramBuild(ctx, program, "maxrregcount=128"); + + +Using SASS Modules in UR +------------------------ + +A SASS module will be loaded and checked for compatibility at ${x}ProgramBuild. +If the SASS module is incompatible with the device arch then ${x}ProgramBuild +will fail with the error ``CUDA_ERROR_NO_BINARY_FOR_GPU``. + +Using Mixed PTX/SASS Bundles in UR +---------------------------------- + +Mixed PTX/SASS modules can be used to make a program with +${x}ProgramCreateWithBinary. At ${x}ProgramBuild the CUDA driver will check +whether the bundled SASS is compatible with the active device. If the SASS is +compatible then the ${x}_program_handle_t will be built from the SASS, and if +not then the PTX will be used as a fallback and JIT compiled by the CUDA +driver. If both PTX and SASS are incompatible with the active device then +${x}ProgramBuild will fail with the error ``CUDA_ERROR_NO_BINARY_FOR_GPU``. + +UR Kernels +========== + +Once ${x}ProgramCreateWithBinary and ${x}ProgramBuild have succeeded, kernels +can be fetched from programs with ${x}KernelCreate. ${x}KernelCreate must be +called with the exact name of the kernel in the PTX/SASS module. This name will +depend on the mangling used when compiling the kernel, so it is recommended to +examine the symbols in the PTX/SASS module before trying to extract kernels in +UR. + +.. code-block:: console + + $ cuobjdump --dump-elf-symbols hello.cubin | grep mykernel + _Z13mykernelv + +At present it is not possible to query the names of the kernels in a UR program +for CUDA, so it is necessary to know the (mangled or otherwise) names of kernels +in advance or by some other means. + +UR kernels can be dispatched with ${x}EnqueueKernelLaunch. The argument +``pGlobalWorkOffset`` can only be used if the kernels have been instrumented to +take the extra global offset argument. Use of the global offset is not +recommended for non SYCL compiler toolchains. This parameter can be ignored if +the user does not wish to use the global offset. + +Other Notes +=========== + +- The environment variable ``SYCL_PI_CUDA_MAX_LOCAL_MEM_SIZE`` can be set in + order to exceed the default max dynamic local memory size. More information + can be found + `here `_. +- The size of primitive datatypes may differ in host and device code. For + instance, NVCC treats ``long double`` as 8 bytes for device and 16 bytes for + host. +- In kernel ``printf`` for NVPTX targets does not support the ``%z`` modifier. + +Contributors +------------ + +* Hugh Delaney `hugh.delaney@codeplay.com `_ + diff --git a/scripts/core/HIP.rst b/scripts/core/HIP.rst new file mode 100644 index 0000000000..6e8304fe85 --- /dev/null +++ b/scripts/core/HIP.rst @@ -0,0 +1,95 @@ +<% + OneApi=tags['$OneApi'] + x=tags['$x'] + X=x.upper() +%> + +============================= +AMD HIP UR Reference Document +============================= + +This document gives general guidelines of how to use UR to execute kernels on +a AMD HIP device. + +Device code +=========== + +Unlike the NVPTX platform, AMDGPU does not use a device IR that can be JIT +compiled at runtime. Therefore, all device binaries must be precompiled for a +particular arch. + +The naming of AMDGPU device code files may vary across different generations +of devices. ``.hsa`` or ``.hsaco`` are common extensions as of 2023. + +HIPCC can generate device code for a particular arch using the ``--genco`` flag + +.. code-block:: console + + $ hipcc --genco hello.cu --amdgpu-target=gfx906 -o hello.hsaco + +UR Programs +=========== + +A ${x}_program_handle_t has a one to one mapping with the HIP runtime object +`hipModule_t `__ + +In UR for HIP, a ${x}_program_handle_t can be created using +${x}ProgramCreateWithBinary with: + +* A single device code module + +A ${x}_program_handle_t is valid only for a single architecture. If a HIP +compatible binary contains device code for multiple AMDGPU architectures, it is +the user's responsibility to split these separate device images so that +${x}ProgramCreateWithBinary is only called with a device binary for a single +device arch. + +If the AMDGPU module is incompatible with the device arch then ${x}ProgramBuild +will fail with the error ``hipErrorNoBinaryForGpu``. + +If a program is large and contains many kernels, loading the program may have a +high overhead. This can be mitigated by splitting a program into multiple +smaller programs. In this way, an application will only pay the overhead of +loading kernels that it will likely use. + +Kernels +======= + +Once ${x}ProgramCreateWithBinary and ${x}ProgramBuild have succeeded, kernels +can be fetched from programs with ${x}KernelCreate. ${x}KernelCreate must be +called with the exact name of the kernel in the AMDGPU device code module. This +name will depend on the mangling used when compiling the kernel, so it is +recommended to examine the symbols in the AMDGPU device code module before +trying to extract kernels in UR code. + +``llvm-objdump`` or ``readelf`` may not correctly view the symbols in an AMDGPU +device module. It may be necessary to call ``clang-offload-bundler`` first in +order to extract the ``ELF`` file that can be passed to ``readelf``. + +.. code-block:: console + + $ clang-offload-bundler --unbundle --input=hello.hsaco --output=hello.o \ + --targets=hipv4-amdgcn-amd-amdhsa--gfx906 --type=o + $ readelf hello.o -s | grep mykernel + _Z13mykernelv + +At present it is not possible to query the names of the kernels in a UR program +for HIP, so it is necessary to know the (mangled or otherwise) names of kernels +in advance or by some other means. + +UR kernels can be dispatched with ${x}EnqueueKernelLaunch. The argument +``pGlobalWorkOffset`` can only be used if the kernels have been instrumented to +take the extra global offset argument. Use of the global offset is not +recommended for non SYCL compiler toolchains. This parameter can be ignored if +the user does not wish to use the global offset. + +Other Notes +=========== + +- In kernel ``printf`` may not work for certain ROCm versions. + +Contributors +------------ + +* Hugh Delaney `hugh.delaney@codeplay.com `_ + diff --git a/scripts/templates/index.rst.mako b/scripts/templates/index.rst.mako index 8a53ba0427..1d5ba6a9b0 100644 --- a/scripts/templates/index.rst.mako +++ b/scripts/templates/index.rst.mako @@ -14,5 +14,7 @@ core/INTRO.rst core/PROG.rst core/CONTRIB.rst + core/CUDA.rst + core/HIP.rst exp-features.rst api.rst From b29b23c8f05a80536432a23814d71ad4a801cfda Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Tue, 12 Sep 2023 10:39:37 +0100 Subject: [PATCH 021/145] [UMF] Fix -Wempty-body warning --- source/common/unified_malloc_framework/src/utils/utils.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/common/unified_malloc_framework/src/utils/utils.h b/source/common/unified_malloc_framework/src/utils/utils.h index ce1da38601..4dd779c57b 100644 --- a/source/common/unified_malloc_framework/src/utils/utils.h +++ b/source/common/unified_malloc_framework/src/utils/utils.h @@ -73,9 +73,8 @@ static inline void *Zalloc(size_t s) { } #define NOFUNCTION \ - do \ - ; \ - while (0) + do { \ + } while (0) #define VALGRIND_ANNOTATE_NEW_MEMORY(p, s) NOFUNCTION #define VALGRIND_HG_DRD_DISABLE_CHECKING(p, s) NOFUNCTION From 739d11cf601af24a243ad979bc2b6a3e0b72d955 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Tue, 12 Sep 2023 12:38:04 +0100 Subject: [PATCH 022/145] [UR] Enable warnings for empty-body --- cmake/helpers.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake index 93c542c5fe..d1e1ae25e3 100644 --- a/cmake/helpers.cmake +++ b/cmake/helpers.cmake @@ -63,6 +63,7 @@ function(add_ur_target_compile_options name) -fPIC -Wall -Wpedantic + -Wempty-body $<$:-fdiagnostics-color=always> $<$:-fcolor-diagnostics> ) From db69f90896ae3f5fb3d7847a06b9a0149df95c5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio?= Date: Wed, 13 Sep 2023 17:15:40 +0100 Subject: [PATCH 023/145] Add extra checks for optional parameters and invalid flags (#857) - Refactors the error code generation script - Adds checks for optional parameters - Adds checks for invalid combinations of flags in urQueueCreate Closes #856 --- include/ur_api.h | 20 +++- scripts/core/queue.yml | 5 +- scripts/parse_specs.py | 100 +++++++++--------- source/loader/layers/validation/ur_valddi.cpp | 50 +++++++++ source/loader/ur_libapi.cpp | 20 +++- source/ur_api.cpp | 20 +++- test/conformance/queue/urQueueCreate.cpp | 2 +- 7 files changed, 159 insertions(+), 58 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 389bd183f3..52e450484d 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -1717,6 +1717,7 @@ typedef struct ur_device_partition_properties_t { /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pProperties` +/// + `NULL == pProperties->pProperties` /// - ::UR_RESULT_ERROR_DEVICE_PARTITION_FAILED /// - ::UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT UR_APIEXPORT ur_result_t UR_APICALL @@ -2029,6 +2030,8 @@ typedef struct ur_context_properties_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phDevices` /// + `NULL == phContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_CONTEXT_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY UR_APIEXPORT ur_result_t UR_APICALL @@ -3273,6 +3276,8 @@ typedef struct ur_usm_pool_limits_desc_t { /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -3317,6 +3322,8 @@ urUSMHostAlloc( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -3363,6 +3370,8 @@ urUSMDeviceAlloc( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -3805,6 +3814,8 @@ typedef struct ur_physical_mem_properties_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_PHYSICAL_MEM_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phPhysicalMem` /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -4882,6 +4893,8 @@ typedef struct ur_kernel_arg_mem_obj_properties_t { /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_MEM_FLAGS_MASK & pProperties->memoryAccess` /// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgMemObj( @@ -5135,12 +5148,15 @@ typedef struct ur_queue_index_properties_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_QUEUE_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phQueue` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_DEVICE -/// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES +/// + `pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_HIGH && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_LOW` +/// + `pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_BATCHED && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL @@ -7069,6 +7085,8 @@ typedef struct ur_exp_layered_image_properties_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// + `NULL == pResultPitch` diff --git a/scripts/core/queue.yml b/scripts/core/queue.yml index 88fe153165..15934c0e2f 100644 --- a/scripts/core/queue.yml +++ b/scripts/core/queue.yml @@ -161,8 +161,9 @@ params: returns: - $X_RESULT_ERROR_INVALID_CONTEXT - $X_RESULT_ERROR_INVALID_DEVICE - - $X_RESULT_ERROR_INVALID_VALUE - - $X_RESULT_ERROR_INVALID_QUEUE_PROPERTIES + - $X_RESULT_ERROR_INVALID_QUEUE_PROPERTIES: + - "`pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_HIGH && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_LOW`" + - "`pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_BATCHED && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE`" - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- diff --git a/scripts/parse_specs.py b/scripts/parse_specs.py index 195d53fc5c..9c8a331e76 100644 --- a/scripts/parse_specs.py +++ b/scripts/parse_specs.py @@ -97,7 +97,7 @@ def __validate_ordinal(d): ordinal = None if ordinal != d['ordinal']: - raise Exception("'ordinal' invalid value: '%s'"%d['ordinal']) + raise Exception("'ordinal' invalid value: '%s'"%d['ordinal']) def __validate_version(d, prefix="", base_version=default_version): if 'version' in d: @@ -333,7 +333,7 @@ def __validate_params(d, tags): if item['type'].endswith("flag_t"): raise Exception(prefix+"'type' must not be '*_flag_t': %s"%item['type']) - + if type_traits.is_pointer(item['type']) and "_handle_t" in item['type'] and "[in]" in item['desc']: if not param_traits.is_range(item): raise Exception(prefix+"handle type must include a range(start, end) as part of 'desc'") @@ -342,11 +342,11 @@ def __validate_params(d, tags): if ver < max_ver: raise Exception(prefix+"'version' must be increasing: %s"%item['version']) max_ver = ver - + def __validate_union_tag(d): if d.get('tag') is None: raise Exception(f"{d['name']} must include a 'tag' part of the union.") - + try: if 'type' not in d: raise Exception("every document must have 'type'") @@ -466,7 +466,7 @@ def __filter_desc(d): return d flt = [] - type = d['type'] + type = d['type'] if 'enum' == type: for e in d['etors']: ver = float(e.get('version', default_version)) @@ -706,58 +706,54 @@ def _append(lst, key, val): if val and val not in rets[idx][key]: rets[idx][key].append(val) + def append_nullchecks(param, accessor: str): + if type_traits.is_pointer(param['type']): + _append(rets, "$X_RESULT_ERROR_INVALID_NULL_POINTER", "`NULL == %s`" % accessor) + + elif type_traits.is_funcptr(param['type'], meta): + _append(rets, "$X_RESULT_ERROR_INVALID_NULL_POINTER", "`NULL == %s`" % accessor) + + elif type_traits.is_handle(param['type']) and not type_traits.is_ipc_handle(item['type']): + _append(rets, "$X_RESULT_ERROR_INVALID_NULL_HANDLE", "`NULL == %s`" % accessor) + + def append_enum_checks(param, accessor: str): + ptypename = type_traits.base(param['type']) + + prefix = "`" + if param_traits.is_optional(item): + prefix = "`NULL != %s && " % item['name'] + + if re.match(r"stype", param['name']): + _append(rets, "$X_RESULT_ERROR_UNSUPPORTED_VERSION", prefix + "%s != %s`"%(re.sub(r"(\$\w)_(.*)_t.*", r"\1_STRUCTURE_TYPE_\2", typename).upper(), accessor)) + else: + if type_traits.is_flags(param['type']) and 'bit_mask' in meta['enum'][ptypename].keys(): + _append(rets, "$X_RESULT_ERROR_INVALID_ENUMERATION", prefix + "%s & %s`"%(ptypename.upper()[:-2]+ "_MASK", accessor)) + else: + _append(rets, "$X_RESULT_ERROR_INVALID_ENUMERATION", prefix + "%s < %s`"%(meta['enum'][ptypename]['max'], accessor)) + # generate results based on parameters for item in obj['params']: if param_traits.is_nocheck(item): continue if not param_traits.is_optional(item): + append_nullchecks(item, item['name']) + + if type_traits.is_enum(item['type'], meta) and not type_traits.is_pointer(item['type']): + append_enum_checks(item, item['name']) + + if type_traits.is_descriptor(item['type']) or type_traits.is_properties(item['type']): typename = type_traits.base(item['type']) + # walk each entry in the desc for pointers and enums + for i, m in enumerate(meta['struct'][typename]['members']): + if param_traits.is_nocheck(m): + continue + + if not param_traits.is_optional(m): + append_nullchecks(m, "%s->%s" % (item['name'], m['name'])) - if type_traits.is_pointer(item['type']): - _append(rets, "$X_RESULT_ERROR_INVALID_NULL_POINTER", "`NULL == %s`"%item['name']) - - elif type_traits.is_funcptr(item['type'], meta): - _append(rets, "$X_RESULT_ERROR_INVALID_NULL_POINTER", "`NULL == %s`"%item['name']) - - elif type_traits.is_handle(item['type']) and not type_traits.is_ipc_handle(item['type']): - _append(rets, "$X_RESULT_ERROR_INVALID_NULL_HANDLE", "`NULL == %s`"%item['name']) - - elif type_traits.is_enum(item['type'], meta): - if type_traits.is_flags(item['type']) and 'bit_mask' in meta['enum'][typename].keys(): - _append(rets, "$X_RESULT_ERROR_INVALID_ENUMERATION", "`%s & %s`"%(typename.upper()[:-2]+ "_MASK", item['name'])) - else: - _append(rets, "$X_RESULT_ERROR_INVALID_ENUMERATION", "`%s < %s`"%(meta['enum'][typename]['max'], item['name'])) - - if type_traits.is_descriptor(item['type']): - # walk each entry in the desc for pointers and enums - for i, m in enumerate(meta['struct'][typename]['members']): - if param_traits.is_nocheck(m): - continue - mtypename = type_traits.base(m['type']) - - if type_traits.is_pointer(m['type']) and not param_traits.is_optional({'desc': m['desc']}): - _append(rets, - "$X_RESULT_ERROR_INVALID_NULL_POINTER", - "`NULL == %s->%s`"%(item['name'], m['name'])) - - elif type_traits.is_enum(m['type'], meta): - if re.match(r"stype", m['name']): - _append(rets, "$X_RESULT_ERROR_UNSUPPORTED_VERSION", "`%s != %s->stype`"%(re.sub(r"(\$\w)_(.*)_t.*", r"\1_STRUCTURE_TYPE_\2", typename).upper(), item['name'])) - else: - if type_traits.is_flags(m['type']) and 'bit_mask' in meta['enum'][mtypename].keys(): - _append(rets, "$X_RESULT_ERROR_INVALID_ENUMERATION", "`%s & %s->%s`"%(mtypename.upper()[:-2]+ "_MASK", item['name'], m['name'])) - else: - _append(rets, "$X_RESULT_ERROR_INVALID_ENUMERATION", "`%s < %s->%s`"%(meta['enum'][mtypename]['max'], item['name'], m['name'])) - - elif type_traits.is_properties(item['type']): - # walk each entry in the properties - for i, m in enumerate(meta['struct'][typename]['members']): - if param_traits.is_nocheck(m): - continue - if type_traits.is_enum(m['type'], meta): - if re.match(r"stype", m['name']): - _append(rets, "$X_RESULT_ERROR_UNSUPPORTED_VERSION", "`%s != %s->stype`"%(re.sub(r"(\$\w)_(.*)_t.*", r"\1_STRUCTURE_TYPE_\2", typename).upper(), item['name'])) + if type_traits.is_enum(m['type'], meta) and not type_traits.is_pointer(m['type']): + append_enum_checks(m, "%s->%s" % (item['name'], m['name'])) # finally, append all user entries for item in obj.get('returns', []): @@ -823,7 +819,7 @@ def _refresh_enum_meta(obj, meta): ## remove the existing meta records if obj.get('class'): meta['class'][obj['class']]['enum'].remove(obj['name']) - + if meta['enum'].get(obj['name']): del meta['enum'][obj['name']] ## re-generate meta @@ -851,13 +847,13 @@ def _extend_enums(enum_extensions, specs, meta): if not _validate_ext_enum_range(extension, matching_enum): raise Exception(f"Invalid enum values.") matching_enum['etors'].extend(extension['etors']) - + _refresh_enum_meta(matching_enum, meta) ## Sort the etors value = -1 def sort_etors(x): - nonlocal value + nonlocal value value = _get_etor_value(x.get('value'), value) return value matching_enum['etors'] = sorted(matching_enum['etors'], key=sort_etors) diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 5df41be123..fe689c8537 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -566,6 +566,10 @@ __urdlllocal ur_result_t UR_APICALL urDevicePartition( if (NULL == pProperties) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + + if (NULL == pProperties->pProperties) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } } ur_result_t result = pfnPartition(hDevice, pProperties, NumDevices, @@ -739,6 +743,10 @@ __urdlllocal ur_result_t UR_APICALL urContextCreate( if (NULL == phContext) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + + if (NULL != pProperties && UR_CONTEXT_FLAGS_MASK & pProperties->flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } } ur_result_t result = @@ -1616,6 +1624,10 @@ __urdlllocal ur_result_t UR_APICALL urUSMHostAlloc( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + if (NULL != pUSMDesc && UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + if (pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) { return UR_RESULT_ERROR_INVALID_VALUE; @@ -1663,6 +1675,10 @@ __urdlllocal ur_result_t UR_APICALL urUSMDeviceAlloc( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + if (NULL != pUSMDesc && UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + if (pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) { return UR_RESULT_ERROR_INVALID_VALUE; @@ -1711,6 +1727,10 @@ __urdlllocal ur_result_t UR_APICALL urUSMSharedAlloc( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + if (NULL != pUSMDesc && UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + if (pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) { return UR_RESULT_ERROR_INVALID_VALUE; @@ -2236,6 +2256,11 @@ __urdlllocal ur_result_t UR_APICALL urPhysicalMemCreate( if (NULL == phPhysicalMem) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + + if (NULL != pProperties && + UR_PHYSICAL_MEM_FLAGS_MASK & pProperties->flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } } ur_result_t result = @@ -3208,6 +3233,11 @@ __urdlllocal ur_result_t UR_APICALL urKernelSetArgMemObj( if (NULL == hKernel) { return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } + + if (NULL != pProperties && + UR_MEM_FLAGS_MASK & pProperties->memoryAccess) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } } ur_result_t result = @@ -3398,6 +3428,22 @@ __urdlllocal ur_result_t UR_APICALL urQueueCreate( if (NULL == phQueue) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + + if (NULL != pProperties && UR_QUEUE_FLAGS_MASK & pProperties->flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (pProperties != NULL && + pProperties->flags & UR_QUEUE_FLAG_PRIORITY_HIGH && + pProperties->flags & UR_QUEUE_FLAG_PRIORITY_LOW) { + return UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES; + } + + if (pProperties != NULL && + pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_BATCHED && + pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) { + return UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES; + } } ur_result_t result = pfnCreate(hContext, hDevice, pProperties, phQueue); @@ -5556,6 +5602,10 @@ __urdlllocal ur_result_t UR_APICALL urUSMPitchedAllocExp( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + if (NULL != pUSMDesc && UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + if (pUSMDesc && pUSMDesc->align != 0 && ((pUSMDesc->align & (pUSMDesc->align - 1)) != 0)) { return UR_RESULT_ERROR_INVALID_VALUE; diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 9558288694..9cf875d82d 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -896,6 +896,7 @@ ur_result_t UR_APICALL urDeviceRelease( /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pProperties` +/// + `NULL == pProperties->pProperties` /// - ::UR_RESULT_ERROR_DEVICE_PARTITION_FAILED /// - ::UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT ur_result_t UR_APICALL urDevicePartition( @@ -1115,6 +1116,8 @@ ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phDevices` /// + `NULL == phContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_CONTEXT_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY ur_result_t UR_APICALL urContextCreate( @@ -2089,6 +2092,8 @@ ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -2144,6 +2149,8 @@ ur_result_t UR_APICALL urUSMHostAlloc( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -2201,6 +2208,8 @@ ur_result_t UR_APICALL urUSMDeviceAlloc( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -2709,6 +2718,8 @@ ur_result_t UR_APICALL urVirtualMemGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_PHYSICAL_MEM_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phPhysicalMem` /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -3782,6 +3793,8 @@ ur_result_t UR_APICALL urKernelSetArgSampler( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_MEM_FLAGS_MASK & pProperties->memoryAccess` /// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX ur_result_t UR_APICALL urKernelSetArgMemObj( ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object @@ -3996,12 +4009,15 @@ ur_result_t UR_APICALL urQueueGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_QUEUE_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phQueue` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_DEVICE -/// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES +/// + `pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_HIGH && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_LOW` +/// + `pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_BATCHED && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urQueueCreate( @@ -6130,6 +6146,8 @@ ur_result_t UR_APICALL urEnqueueWriteHostPipe( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// + `NULL == pResultPitch` diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 4289b0fc53..335150afb1 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -776,6 +776,7 @@ ur_result_t UR_APICALL urDeviceRelease( /// + `NULL == hDevice` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pProperties` +/// + `NULL == pProperties->pProperties` /// - ::UR_RESULT_ERROR_DEVICE_PARTITION_FAILED /// - ::UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT ur_result_t UR_APICALL urDevicePartition( @@ -960,6 +961,8 @@ ur_result_t UR_APICALL urDeviceGetGlobalTimestamps( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phDevices` /// + `NULL == phContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_CONTEXT_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY ur_result_t UR_APICALL urContextCreate( @@ -1781,6 +1784,8 @@ ur_result_t UR_APICALL urSamplerCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -1830,6 +1835,8 @@ ur_result_t UR_APICALL urUSMHostAlloc( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -1881,6 +1888,8 @@ ur_result_t UR_APICALL urUSMDeviceAlloc( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT @@ -2300,6 +2309,8 @@ ur_result_t UR_APICALL urVirtualMemGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_PHYSICAL_MEM_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phPhysicalMem` /// - ::UR_RESULT_ERROR_INVALID_SIZE @@ -3199,6 +3210,8 @@ ur_result_t UR_APICALL urKernelSetArgSampler( /// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_MEM_FLAGS_MASK & pProperties->memoryAccess` /// - ::UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX ur_result_t UR_APICALL urKernelSetArgMemObj( ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object @@ -3379,12 +3392,15 @@ ur_result_t UR_APICALL urQueueGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pProperties && ::UR_QUEUE_FLAGS_MASK & pProperties->flags` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phQueue` /// - ::UR_RESULT_ERROR_INVALID_CONTEXT /// - ::UR_RESULT_ERROR_INVALID_DEVICE -/// - ::UR_RESULT_ERROR_INVALID_VALUE /// - ::UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES +/// + `pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_HIGH && pProperties->flags & UR_QUEUE_FLAG_PRIORITY_LOW` +/// + `pProperties != NULL && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_BATCHED && pProperties->flags & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE` /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urQueueCreate( @@ -5214,6 +5230,8 @@ ur_result_t UR_APICALL urEnqueueWriteHostPipe( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hContext` /// + `NULL == hDevice` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `NULL != pUSMDesc && ::UR_USM_ADVICE_FLAGS_MASK & pUSMDesc->hints` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == ppMem` /// + `NULL == pResultPitch` diff --git a/test/conformance/queue/urQueueCreate.cpp b/test/conformance/queue/urQueueCreate.cpp index 0f99009abd..da7995a1f4 100644 --- a/test/conformance/queue/urQueueCreate.cpp +++ b/test/conformance/queue/urQueueCreate.cpp @@ -72,7 +72,7 @@ TEST_P(urQueueCreateTest, InvalidValueProperties) { /*.pNext =*/nullptr, /*.flags =*/UR_QUEUE_FLAG_FORCE_UINT32, }; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_VALUE, + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, urQueueCreate(context, device, &props, &queue)); } From 04b5da30f9f1d3d6ab6dc88e72b67e48f4ebd001 Mon Sep 17 00:00:00 2001 From: Callum Fare Date: Wed, 13 Sep 2023 16:38:58 +0100 Subject: [PATCH 024/145] Add more detailed build instructions to the Contribution Guide Resolve #582 by adding more detailed instructions on using the `generate` target. --- README.md | 13 +++++++-- scripts/core/CONTRIB.rst | 63 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 69 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ad0c629555..d97848ecc4 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,12 @@ Tools can be acquired via instructions in [third_party](/third_party/README.md). ## Building +The requirements and instructions below are for building the project from source +without any modifications. To make modifications to the specification, please +see the +[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html) +for more detailed instructions on the correct setup. + ### Requirements Required packages: @@ -79,9 +85,6 @@ Required packages: - [CMake](https://cmake.org/) >= 3.14.0 - Python v3.6.6 or later -For development and contributions: -- clang-format-15.0 (can be installed with `python -m pip install clang-format==15.0.7`) - ### Windows Generating Visual Studio Project. EXE and binaries will be in **build/bin/{build_config}** @@ -137,6 +140,10 @@ It will generate the source code **and** run automated code formatting: $ make generate ``` +This target has additional dependencies which are described in the *Build +Environment* section of the +[Contribution Guide](https://oneapi-src.github.io/unified-runtime/core/CONTRIB.html). + ## Contributions For those who intend to make a contribution to the project please read our diff --git a/scripts/core/CONTRIB.rst b/scripts/core/CONTRIB.rst index 137f190b31..3264422c45 100644 --- a/scripts/core/CONTRIB.rst +++ b/scripts/core/CONTRIB.rst @@ -39,6 +39,62 @@ accepted into the project. Runtime team via the `GitHub issue tracker `_. +Build Environment +================= + +To be able to generate the source from the YAML files, the build environment +must be configured correctly and all dependencies must be installed. The +instructions for a basic setup are available in the `README +`_. + +The following additional dependencies are required to support the ``generate`` +target: + +* Doxygen (>= 1.8) + +* The Python script requirements listed in `thirdparty/requirements.txt`_ + +Doxygen can be installed via your system's package manager, e.g. on Ubuntu +``sudo apt install doxygen``, or by downloading it from the Doxygen website. It +must be available on the current ``PATH`` when the script is run. + +One way to install the requirements for the script is using a Python virtual +environment. This can be set up by running the following commands from the +project root: + +.. code-block:: console + + $ python3 -m venv .local + $ source .local/bin/activate + $ pip install -r third_party/requirements.txt + +The virtual environment can be subsequently reactivated before any builds +without needing to reinstall the requirements: + +.. code-block:: console + + $ source .local/bin/activate + +Alternatively, a Docker container can be used instead of a virtual environment. +Instructions on building and using a Docker image can be found in +`.github/docker`_ + +You *must* also enable the ``UR_FORMAT_CPP_STYLE`` CMake option to allow +formatting of the generated code, or the ``generate`` target will not be +available. + +.. code-block:: console + + $ cmake build/ -DUR_FORMAT_CPP_STYLE=ON + +You can then follow the instructions below to use the ``generate`` target to +regenerate the source. + +.. _thirdparty/requirements.txt: + https://github.com/oneapi-src/unified-runtime/blob/main/third_party/requirements.txt +.. _.github/docker: + https://github.com/oneapi-src/unified-runtime/blob/main/.github/docker + Generating Source ================= @@ -46,10 +102,9 @@ The specification and many other components in the Unified Runtime repository are generated from a set of YAML_ files which are used as inputs to a Mako_ based templating system. The YAML file syntax is defined in `YAML syntax`_. To generate the outputs of the Mako templates a build directory must be -configured, instructions are available in the `README -`_ file. -Upon successfully configuring a build directory, generate the outputs with the -following command (or suitable build system equivalent): +configured as detailed above. Upon successfully configuring a build directory, +generate the outputs with the following command (or suitable build system +equivalent): .. code-block:: console From fdffac343a7209fd3ab7c749538738a77c108a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio?= Date: Thu, 14 Sep 2023 13:54:37 +0100 Subject: [PATCH 025/145] Clarify the behaviour of urUSMMemAdvise and urUSMPrefetch when the hint is unsupported (#854) --- include/ur_api.h | 10 ++++++++++ scripts/core/enqueue.yml | 8 +++++++- source/loader/ur_libapi.cpp | 10 ++++++++++ source/ur_api.cpp | 10 ++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/include/ur_api.h b/include/ur_api.h index 52e450484d..6c445fc408 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -6627,6 +6627,11 @@ urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to prefetch USM memory /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -6668,6 +6673,11 @@ urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to set USM memory advice /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED diff --git a/scripts/core/enqueue.yml b/scripts/core/enqueue.yml index 67a3adbee6..8d3347dfbe 100644 --- a/scripts/core/enqueue.yml +++ b/scripts/core/enqueue.yml @@ -1088,6 +1088,9 @@ desc: "Enqueue a command to prefetch USM memory" class: $xEnqueue name: USMPrefetch ordinal: "0" +details: + - "Prefetching may not be supported for all devices or allocation types. If memory prefetching + is not supported, the prefetch hint will be ignored." params: - type: $x_queue_handle_t name: hQueue @@ -1128,10 +1131,13 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function -desc: "Enqueue a command to set USM memory advice" +desc: "Enqueue a command to set USM memory advice" class: $xEnqueue name: USMAdvise ordinal: "0" +details: + - "Not all memory advice hints may be supported for all devices or allocation types. + If a memory advice hint is not supported, it will be ignored." params: - type: $x_queue_handle_t name: hQueue diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 9cf875d82d..dced46e279 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -5685,6 +5685,11 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to prefetch USM memory /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -5737,6 +5742,11 @@ ur_result_t UR_APICALL urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to set USM memory advice /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 335150afb1..4bc1cc2889 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -4830,6 +4830,11 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to prefetch USM memory /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -4875,6 +4880,11 @@ ur_result_t UR_APICALL urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Enqueue a command to set USM memory advice /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED From 019551ca4062016c26c364b5aee11c73b617bc9f Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Fri, 15 Sep 2023 09:24:35 +0100 Subject: [PATCH 026/145] [UR] Add validation check to urDeviceGet --- include/ur_api.h | 2 ++ scripts/core/device.yml | 2 ++ source/loader/layers/validation/ur_valddi.cpp | 4 ++++ source/loader/ur_libapi.cpp | 2 ++ source/ur_api.cpp | 2 ++ test/conformance/device/urDeviceGet.cpp | 12 +++++++++++- 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/ur_api.h b/include/ur_api.h index 6c445fc408..298531957a 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -1304,6 +1304,8 @@ typedef enum ur_device_type_t { /// + `::UR_DEVICE_TYPE_VPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NumEntries > 0 && phDevices == NULL` /// - ::UR_RESULT_ERROR_INVALID_VALUE UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet( diff --git a/scripts/core/device.yml b/scripts/core/device.yml index 4d304dc12f..3999fa70f2 100644 --- a/scripts/core/device.yml +++ b/scripts/core/device.yml @@ -146,6 +146,8 @@ params: returns: - $X_RESULT_ERROR_INVALID_SIZE: - "`NumEntries == 0 && phDevices != NULL`" + - $X_RESULT_ERROR_INVALID_NULL_POINTER: + - "`NumEntries > 0 && phDevices == NULL`" - $X_RESULT_ERROR_INVALID_VALUE --- #-------------------------------------------------------------------------- type: enum diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index fe689c8537..4698c0cf1b 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -419,6 +419,10 @@ __urdlllocal ur_result_t UR_APICALL urDeviceGet( return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } + if (NumEntries > 0 && phDevices == NULL) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + if (UR_DEVICE_TYPE_VPU < DeviceType) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index dced46e279..357c0c3c15 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -714,6 +714,8 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// + `::UR_DEVICE_TYPE_VPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NumEntries > 0 && phDevices == NULL` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGet( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 4bc1cc2889..93c06a40ab 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -618,6 +618,8 @@ ur_result_t UR_APICALL urPlatformGetBackendOption( /// + `::UR_DEVICE_TYPE_VPU < DeviceType` /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `NumEntries == 0 && phDevices != NULL` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NumEntries > 0 && phDevices == NULL` /// - ::UR_RESULT_ERROR_INVALID_VALUE ur_result_t UR_APICALL urDeviceGet( ur_platform_handle_t hPlatform, ///< [in] handle of the platform instance diff --git a/test/conformance/device/urDeviceGet.cpp b/test/conformance/device/urDeviceGet.cpp index 85a4818d09..e8aa356a58 100644 --- a/test/conformance/device/urDeviceGet.cpp +++ b/test/conformance/device/urDeviceGet.cpp @@ -49,7 +49,7 @@ TEST_F(urDeviceGetTest, InvalidEnumerationDevicesType) { urDeviceGet(platform, UR_DEVICE_TYPE_FORCE_UINT32, 0, nullptr, &count)); } -TEST_F(urDeviceGetTest, InvalidValueNumEntries) { +TEST_F(urDeviceGetTest, InvalidSizeNumEntries) { uint32_t count = 0; ASSERT_SUCCESS( urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count)); @@ -59,3 +59,13 @@ TEST_F(urDeviceGetTest, InvalidValueNumEntries) { UR_RESULT_ERROR_INVALID_SIZE, urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, devices.data(), nullptr)); } + +TEST_F(urDeviceGetTest, InvalidNullPointerDevices) { + uint32_t count = 0; + ASSERT_SUCCESS( + urDeviceGet(platform, UR_DEVICE_TYPE_ALL, 0, nullptr, &count)); + ASSERT_NE(count, 0); + ASSERT_EQ_RESULT( + UR_RESULT_ERROR_INVALID_NULL_POINTER, + urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, nullptr, nullptr)); +} From bb542f3563eba6a4e9bd5056340f668e7f2e546b Mon Sep 17 00:00:00 2001 From: Michael Aziz Date: Tue, 5 Sep 2023 13:37:56 -0700 Subject: [PATCH 027/145] Add cooperative kernels experimental feature Signed-off-by: Michael Aziz --- include/ur.py | 59 +++++ include/ur_api.h | 111 +++++++++ include/ur_ddi.h | 75 ++++++ scripts/core/EXP-COOPERATIVE-KERNELS.rst | 68 ++++++ scripts/core/exp-cooperative-kernels.yml | 85 +++++++ scripts/core/registry.yml | 6 + source/adapters/null/ur_nullddi.cpp | 136 +++++++++++ source/common/ur_params.hpp | 93 ++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 173 ++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 182 +++++++++++++++ source/loader/ur_ldrddi.cpp | 213 ++++++++++++++++++ source/loader/ur_libapi.cpp | 97 ++++++++ source/loader/ur_libddi.cpp | 10 + source/ur_api.cpp | 80 +++++++ 14 files changed, 1388 insertions(+) create mode 100644 scripts/core/EXP-COOPERATIVE-KERNELS.rst create mode 100644 scripts/core/exp-cooperative-kernels.yml diff --git a/include/ur.py b/include/ur.py index c6ce722221..6860304683 100644 --- a/include/ur.py +++ b/include/ur.py @@ -198,6 +198,8 @@ class ur_function_v(IntEnum): COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190 ## Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191## Enumerator for ::urCommandBufferAppendMemBufferReadRectExp COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192 ## Enumerator for ::urCommandBufferAppendMemBufferFillExp + ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193 ## Enumerator for ::urEnqueueCooperativeKernelLaunchExp + KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp class ur_function_t(c_int): def __str__(self): @@ -2272,6 +2274,11 @@ class ur_exp_command_buffer_sync_point_t(c_ulong): class ur_exp_command_buffer_handle_t(c_void_p): pass +############################################################################### +## @brief The extension string which defines support for cooperative-kernels +## which is returned when querying device extensions. +UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP = "ur_exp_cooperative_kernels" + ############################################################################### ## @brief Supported peer info class ur_exp_peer_info_v(IntEnum): @@ -2715,6 +2722,21 @@ class ur_kernel_dditable_t(Structure): ("pfnSetSpecializationConstants", c_void_p) ## _urKernelSetSpecializationConstants_t ] +############################################################################### +## @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp +if __use_win_types: + _urKernelSuggestMaxCooperativeGroupCountExp_t = WINFUNCTYPE( ur_result_t, ur_kernel_handle_t, POINTER(c_ulong) ) +else: + _urKernelSuggestMaxCooperativeGroupCountExp_t = CFUNCTYPE( ur_result_t, ur_kernel_handle_t, POINTER(c_ulong) ) + + +############################################################################### +## @brief Table of KernelExp functions pointers +class ur_kernel_exp_dditable_t(Structure): + _fields_ = [ + ("pfnSuggestMaxCooperativeGroupCountExp", c_void_p) ## _urKernelSuggestMaxCooperativeGroupCountExp_t + ] + ############################################################################### ## @brief Function-pointer for urSamplerCreate if __use_win_types: @@ -3142,6 +3164,21 @@ class ur_enqueue_dditable_t(Structure): ("pfnWriteHostPipe", c_void_p) ## _urEnqueueWriteHostPipe_t ] +############################################################################### +## @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp +if __use_win_types: + _urEnqueueCooperativeKernelLaunchExp_t = WINFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) ) +else: + _urEnqueueCooperativeKernelLaunchExp_t = CFUNCTYPE( ur_result_t, ur_queue_handle_t, ur_kernel_handle_t, c_ulong, POINTER(c_size_t), POINTER(c_size_t), POINTER(c_size_t), c_ulong, POINTER(ur_event_handle_t), POINTER(ur_event_handle_t) ) + + +############################################################################### +## @brief Table of EnqueueExp functions pointers +class ur_enqueue_exp_dditable_t(Structure): + _fields_ = [ + ("pfnCooperativeKernelLaunchExp", c_void_p) ## _urEnqueueCooperativeKernelLaunchExp_t + ] + ############################################################################### ## @brief Function-pointer for urQueueGetInfo if __use_win_types: @@ -3774,11 +3811,13 @@ class ur_dditable_t(Structure): ("Event", ur_event_dditable_t), ("Program", ur_program_dditable_t), ("Kernel", ur_kernel_dditable_t), + ("KernelExp", ur_kernel_exp_dditable_t), ("Sampler", ur_sampler_dditable_t), ("Mem", ur_mem_dditable_t), ("PhysicalMem", ur_physical_mem_dditable_t), ("Global", ur_global_dditable_t), ("Enqueue", ur_enqueue_dditable_t), + ("EnqueueExp", ur_enqueue_exp_dditable_t), ("Queue", ur_queue_dditable_t), ("BindlessImagesExp", ur_bindless_images_exp_dditable_t), ("USM", ur_usm_dditable_t), @@ -3899,6 +3938,16 @@ def __init__(self, version : ur_api_version_t): self.urKernelSetArgMemObj = _urKernelSetArgMemObj_t(self.__dditable.Kernel.pfnSetArgMemObj) self.urKernelSetSpecializationConstants = _urKernelSetSpecializationConstants_t(self.__dditable.Kernel.pfnSetSpecializationConstants) + # call driver to get function pointers + KernelExp = ur_kernel_exp_dditable_t() + r = ur_result_v(self.__dll.urGetKernelExpProcAddrTable(version, byref(KernelExp))) + if r != ur_result_v.SUCCESS: + raise Exception(r) + self.__dditable.KernelExp = KernelExp + + # attach function interface to function address + self.urKernelSuggestMaxCooperativeGroupCountExp = _urKernelSuggestMaxCooperativeGroupCountExp_t(self.__dditable.KernelExp.pfnSuggestMaxCooperativeGroupCountExp) + # call driver to get function pointers Sampler = ur_sampler_dditable_t() r = ur_result_v(self.__dll.urGetSamplerProcAddrTable(version, byref(Sampler))) @@ -3993,6 +4042,16 @@ def __init__(self, version : ur_api_version_t): self.urEnqueueReadHostPipe = _urEnqueueReadHostPipe_t(self.__dditable.Enqueue.pfnReadHostPipe) self.urEnqueueWriteHostPipe = _urEnqueueWriteHostPipe_t(self.__dditable.Enqueue.pfnWriteHostPipe) + # call driver to get function pointers + EnqueueExp = ur_enqueue_exp_dditable_t() + r = ur_result_v(self.__dll.urGetEnqueueExpProcAddrTable(version, byref(EnqueueExp))) + if r != ur_result_v.SUCCESS: + raise Exception(r) + self.__dditable.EnqueueExp = EnqueueExp + + # attach function interface to function address + self.urEnqueueCooperativeKernelLaunchExp = _urEnqueueCooperativeKernelLaunchExp_t(self.__dditable.EnqueueExp.pfnCooperativeKernelLaunchExp) + # call driver to get function pointers Queue = ur_queue_dditable_t() r = ur_result_v(self.__dll.urGetQueueProcAddrTable(version, byref(Queue))) diff --git a/include/ur_api.h b/include/ur_api.h index 6c445fc408..84d26d1c31 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -207,6 +207,8 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP = 190, ///< Enumerator for ::urCommandBufferAppendMemBufferWriteRectExp UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP = 191, ///< Enumerator for ::urCommandBufferAppendMemBufferReadRectExp UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp + UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193, ///< Enumerator for ::urEnqueueCooperativeKernelLaunchExp + UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -8171,6 +8173,90 @@ urCommandBufferEnqueueExp( ///< command-buffer execution instance. ); +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for Cooperative Kernels +#if !defined(__GNUC__) +#pragma region cooperative kernels(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP +/// @brief The extension string which defines support for cooperative-kernels +/// which is returned when querying device extensions. +#define UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP "ur_exp_cooperative_kernels" +#endif // UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to execute a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t *pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t *pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t *pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t *phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query the maximum number of work groups for a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGroupCountRet` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +UR_APIEXPORT ur_result_t UR_APICALL +urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups +); + #if !defined(__GNUC__) #pragma endregion #endif @@ -8939,6 +9025,15 @@ typedef struct ur_kernel_set_specialization_constants_params_t { const ur_specialization_constant_info_t **ppSpecConstants; } ur_kernel_set_specialization_constants_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urKernelSuggestMaxCooperativeGroupCountExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t { + ur_kernel_handle_t *phKernel; + uint32_t **ppGroupCountRet; +} ur_kernel_suggest_max_cooperative_group_count_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urSamplerCreate /// @details Each entry is a pointer to the parameter passed to the function; @@ -9586,6 +9681,22 @@ typedef struct ur_enqueue_write_host_pipe_params_t { ur_event_handle_t **pphEvent; } ur_enqueue_write_host_pipe_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urEnqueueCooperativeKernelLaunchExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_enqueue_cooperative_kernel_launch_exp_params_t { + ur_queue_handle_t *phQueue; + ur_kernel_handle_t *phKernel; + uint32_t *pworkDim; + const size_t **ppGlobalWorkOffset; + const size_t **ppGlobalWorkSize; + const size_t **ppLocalWorkSize; + uint32_t *pnumEventsInWaitList; + const ur_event_handle_t **pphEventWaitList; + ur_event_handle_t **pphEvent; +} ur_enqueue_cooperative_kernel_launch_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urQueueGetInfo /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index ff3bfca155..ae5edf6371 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -567,6 +567,39 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetKernelProcAddrTable_t)( ur_api_version_t, ur_kernel_dditable_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urKernelSuggestMaxCooperativeGroupCountExp +typedef ur_result_t(UR_APICALL *ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t)( + ur_kernel_handle_t, + uint32_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of KernelExp functions pointers +typedef struct ur_kernel_exp_dditable_t { + ur_pfnKernelSuggestMaxCooperativeGroupCountExp_t pfnSuggestMaxCooperativeGroupCountExp; +} ur_kernel_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's KernelExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL +urGetKernelExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_kernel_exp_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetKernelExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetKernelExpProcAddrTable_t)( + ur_api_version_t, + ur_kernel_exp_dditable_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urSamplerCreate typedef ur_result_t(UR_APICALL *ur_pfnSamplerCreate_t)( @@ -1246,6 +1279,46 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueProcAddrTable_t)( ur_api_version_t, ur_enqueue_dditable_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urEnqueueCooperativeKernelLaunchExp +typedef ur_result_t(UR_APICALL *ur_pfnEnqueueCooperativeKernelLaunchExp_t)( + ur_queue_handle_t, + ur_kernel_handle_t, + uint32_t, + const size_t *, + const size_t *, + const size_t *, + uint32_t, + const ur_event_handle_t *, + ur_event_handle_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of EnqueueExp functions pointers +typedef struct ur_enqueue_exp_dditable_t { + ur_pfnEnqueueCooperativeKernelLaunchExp_t pfnCooperativeKernelLaunchExp; +} ur_enqueue_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's EnqueueExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL +urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_enqueue_exp_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetEnqueueExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetEnqueueExpProcAddrTable_t)( + ur_api_version_t, + ur_enqueue_exp_dditable_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urQueueGetInfo typedef ur_result_t(UR_APICALL *ur_pfnQueueGetInfo_t)( @@ -2154,11 +2227,13 @@ typedef struct ur_dditable_t { ur_event_dditable_t Event; ur_program_dditable_t Program; ur_kernel_dditable_t Kernel; + ur_kernel_exp_dditable_t KernelExp; ur_sampler_dditable_t Sampler; ur_mem_dditable_t Mem; ur_physical_mem_dditable_t PhysicalMem; ur_global_dditable_t Global; ur_enqueue_dditable_t Enqueue; + ur_enqueue_exp_dditable_t EnqueueExp; ur_queue_dditable_t Queue; ur_bindless_images_exp_dditable_t BindlessImagesExp; ur_usm_dditable_t USM; diff --git a/scripts/core/EXP-COOPERATIVE-KERNELS.rst b/scripts/core/EXP-COOPERATIVE-KERNELS.rst new file mode 100644 index 0000000000..c6b64ef669 --- /dev/null +++ b/scripts/core/EXP-COOPERATIVE-KERNELS.rst @@ -0,0 +1,68 @@ +<% + OneApi=tags['$OneApi'] + x=tags['$x'] + X=x.upper() +%> + +.. _experimental-cooperative-kernels: + +================================================================================ +Cooperative Kernels +================================================================================ + +.. warning:: + + Experimental features: + + * May be replaced, updated, or removed at any time. + * Do not require maintaining API/ABI stability of their own additions over + time. + * Do not require conformance testing of their own additions. + + +Motivation +-------------------------------------------------------------------------------- +Cooperative kernels are kernels that use cross-workgroup synchronization +features. All enqueued workgroups must run concurrently for cooperative kernels +to execute without hanging. This experimental feature provides an API for +querying the maximum number of workgroups and launching cooperative kernels. + +Any device can support cooperative kernels by restricting the maximum number of +workgroups to 1. Devices that support cross-workgroup synchronization can +specify a larger maximum for a given cooperative kernel. + +The functions defined here align with those specified in Level Zero. + +API +-------------------------------------------------------------------------------- + +Macros +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* ${X}_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP + +Functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* ${x}EnqueueCooperativeKernelLaunchExp +* ${x}KernelSuggestMaxCooperativeGroupCountExp + +Changelog +-------------------------------------------------------------------------------- ++-----------+------------------------+ +| Revision | Changes | ++===========+========================+ +| 1.0 | Initial Draft | ++-----------+------------------------+ + +Support +-------------------------------------------------------------------------------- + +Adapters which support this experimental feature *must* return the valid string +defined in ``${X}_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP`` +as one of the options from ${x}DeviceGetInfo when querying for +${X}_DEVICE_INFO_EXTENSIONS. Conversely, before using any of the +functionality defined in this experimental feature the user *must* use the +device query to determine if the adapter supports this feature. + +Contributors +-------------------------------------------------------------------------------- +* Michael Aziz `michael.aziz@intel.com `_ diff --git a/scripts/core/exp-cooperative-kernels.yml b/scripts/core/exp-cooperative-kernels.yml new file mode 100644 index 0000000000..fb2c6b3a4a --- /dev/null +++ b/scripts/core/exp-cooperative-kernels.yml @@ -0,0 +1,85 @@ +# +# Copyright (C) 2023 Intel Corporation +# +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# See YaML.md for syntax definition +# +--- #-------------------------------------------------------------------------- +type: header +desc: "Intel $OneApi Unified Runtime Experimental APIs for Cooperative Kernels" +ordinal: "99" +--- #-------------------------------------------------------------------------- +type: macro +desc: | + The extension string which defines support for cooperative-kernels + which is returned when querying device extensions. +name: $X_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP +value: "\"$x_exp_cooperative_kernels\"" +--- #-------------------------------------------------------------------------- +type: function +desc: "Enqueue a command to execute a cooperative kernel" +class: $xEnqueue +name: CooperativeKernelLaunchExp +params: + - type: $x_queue_handle_t + name: hQueue + desc: "[in] handle of the queue object" + - type: $x_kernel_handle_t + name: hKernel + desc: "[in] handle of the kernel object" + - type: uint32_t + name: workDim + desc: "[in] number of dimensions, from 1 to 3, to specify the global and work-group work-items" + - type: "const size_t*" + name: pGlobalWorkOffset + desc: "[in] pointer to an array of workDim unsigned values that specify the offset used to calculate the global ID of a work-item" + - type: "const size_t*" + name: pGlobalWorkSize + desc: "[in] pointer to an array of workDim unsigned values that specify the number of global work-items in workDim that will execute the kernel function" + - type: "const size_t*" + name: pLocalWorkSize + desc: | + [in][optional] pointer to an array of workDim unsigned values that specify the number of local work-items forming a work-group that will execute the kernel function. + If nullptr, the runtime implementation will choose the work-group size. + - type: uint32_t + name: numEventsInWaitList + desc: "[in] size of the event wait list" + - type: "const $x_event_handle_t*" + name: phEventWaitList + desc: | + [in][optional][range(0, numEventsInWaitList)] pointer to a list of events that must be complete before the kernel execution. + If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. + - type: $x_event_handle_t* + name: phEvent + desc: | + [out][optional] return an event object that identifies this particular kernel execution instance. +returns: + - $X_RESULT_ERROR_INVALID_QUEUE + - $X_RESULT_ERROR_INVALID_KERNEL + - $X_RESULT_ERROR_INVALID_EVENT + - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST: + - "`phEventWaitList == NULL && numEventsInWaitList > 0`" + - "`phEventWaitList != NULL && numEventsInWaitList == 0`" + - "If event objects in phEventWaitList are not valid events." + - $X_RESULT_ERROR_INVALID_WORK_DIMENSION + - $X_RESULT_ERROR_INVALID_WORK_GROUP_SIZE + - $X_RESULT_ERROR_INVALID_VALUE + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function +desc: "Query the maximum number of work groups for a cooperative kernel" +class: $xKernel +name: SuggestMaxCooperativeGroupCountExp +params: + - type: $x_kernel_handle_t + name: hKernel + desc: "[in] handle of the kernel object" + - type: "uint32_t*" + name: "pGroupCountRet" + desc: "[out] pointer to maximum number of groups" +returns: + - $X_RESULT_ERROR_INVALID_KERNEL diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 01b4b50334..4924e3e947 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -535,6 +535,12 @@ etors: - name: COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP desc: Enumerator for $xCommandBufferAppendMemBufferFillExp value: '192' +- name: ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP + desc: Enumerator for $xEnqueueCooperativeKernelLaunchExp + value: '193' +- name: KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP + desc: Enumerator for $xKernelSuggestMaxCooperativeGroupCountExp + value: '194' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index cb87343945..314cb9138e 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4927,6 +4927,80 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp +__urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t + workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t * + pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t * + pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t * + pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t * + phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t * + phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnCooperativeKernelLaunchExp = + d_context.urDdiTable.EnqueueExp.pfnCooperativeKernelLaunchExp; + if (nullptr != pfnCooperativeKernelLaunchExp) { + result = pfnCooperativeKernelLaunchExp( + hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, + pLocalWorkSize, numEventsInWaitList, phEventWaitList, phEvent); + } else { + // generic implementation + if (nullptr != phEvent) { + *phEvent = reinterpret_cast(d_context.get()); + } + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp +__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnSuggestMaxCooperativeGroupCountExp = + d_context.urDdiTable.KernelExp.pfnSuggestMaxCooperativeGroupCountExp; + if (nullptr != pfnSuggestMaxCooperativeGroupCountExp) { + result = pfnSuggestMaxCooperativeGroupCountExp(hKernel, pGroupCountRet); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -5357,6 +5431,37 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueProcAddrTable( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's EnqueueExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_enqueue_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) try { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (driver::d_context.version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + pDdiTable->pfnCooperativeKernelLaunchExp = + driver::urEnqueueCooperativeKernelLaunchExp; + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses @@ -5462,6 +5567,37 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelProcAddrTable( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's KernelExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_kernel_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) try { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (driver::d_context.version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = + driver::urKernelSuggestMaxCooperativeGroupCountExp; + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 04a4636444..4296606987 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -1152,6 +1152,14 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP"; break; + + case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: + os << "UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP"; + break; + + case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: + os << "UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP"; + break; default: os << "unknown enumerator"; break; @@ -12952,6 +12960,65 @@ operator<<(std::ostream &os, return os; } +inline std::ostream &operator<<( + std::ostream &os, + const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { + + os << ".hQueue = "; + + ur_params::serializePtr(os, *(params->phQueue)); + + os << ", "; + os << ".hKernel = "; + + ur_params::serializePtr(os, *(params->phKernel)); + + os << ", "; + os << ".workDim = "; + + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + ur_params::serializePtr(os, *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + ur_params::serializePtr(os, *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + ur_params::serializePtr(os, *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && + i < *params->pnumEventsInWaitList; + ++i) { + if (i != 0) { + os << ", "; + } + + ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + } + os << "}"; + + os << ", "; + os << ".phEvent = "; + + ur_params::serializePtr(os, *(params->pphEvent)); + + return os; +} + inline std::ostream & operator<<(std::ostream &os, const struct ur_event_get_info_params_t *params) { @@ -13499,6 +13566,23 @@ inline std::ostream &operator<<( return os; } +inline std::ostream &operator<<( + std::ostream &os, + const struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t + *params) { + + os << ".hKernel = "; + + ur_params::serializePtr(os, *(params->phKernel)); + + os << ", "; + os << ".pGroupCountRet = "; + + ur_params::serializePtr(os, *(params->ppGroupCountRet)); + + return os; +} + inline std::ostream &operator<<(std::ostream &os, const struct ur_loader_init_params_t *params) { @@ -15718,6 +15802,10 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, case UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE: { os << (const struct ur_enqueue_write_host_pipe_params_t *)params; } break; + case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: { + os << (const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *) + params; + } break; case UR_FUNCTION_EVENT_GET_INFO: { os << (const struct ur_event_get_info_params_t *)params; } break; @@ -15790,6 +15878,11 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_kernel_set_specialization_constants_params_t *) params; } break; + case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: { + os << (const struct + ur_kernel_suggest_max_cooperative_group_count_exp_params_t *) + params; + } break; case UR_FUNCTION_LOADER_INIT: { os << (const struct ur_loader_init_params_t *)params; } break; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 64702ebed5..6e4ce75bb8 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5695,6 +5695,99 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp +__urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t + workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t * + pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t * + pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t * + pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t * + phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t * + phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. +) { + auto pfnCooperativeKernelLaunchExp = + context.urDdiTable.EnqueueExp.pfnCooperativeKernelLaunchExp; + + if (nullptr == pfnCooperativeKernelLaunchExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_enqueue_cooperative_kernel_launch_exp_params_t params = { + &hQueue, + &hKernel, + &workDim, + &pGlobalWorkOffset, + &pGlobalWorkSize, + &pLocalWorkSize, + &numEventsInWaitList, + &phEventWaitList, + &phEvent}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, + "urEnqueueCooperativeKernelLaunchExp", ¶ms); + + ur_result_t result = pfnCooperativeKernelLaunchExp( + hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, + pLocalWorkSize, numEventsInWaitList, phEventWaitList, phEvent); + + context.notify_end(UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP, + "urEnqueueCooperativeKernelLaunchExp", ¶ms, &result, + instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp +__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups +) { + auto pfnSuggestMaxCooperativeGroupCountExp = + context.urDdiTable.KernelExp.pfnSuggestMaxCooperativeGroupCountExp; + + if (nullptr == pfnSuggestMaxCooperativeGroupCountExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_kernel_suggest_max_cooperative_group_count_exp_params_t params = { + &hKernel, &pGroupCountRet}; + uint64_t instance = context.notify_begin( + UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP, + "urKernelSuggestMaxCooperativeGroupCountExp", ¶ms); + + ur_result_t result = + pfnSuggestMaxCooperativeGroupCountExp(hKernel, pGroupCountRet); + + context.notify_end( + UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP, + "urKernelSuggestMaxCooperativeGroupCountExp", ¶ms, &result, + instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -6247,6 +6340,41 @@ __urdlllocal ur_result_t UR_APICALL urGetEnqueueProcAddrTable( return result; } /////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's EnqueueExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +__urdlllocal ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_enqueue_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + auto &dditable = ur_tracing_layer::context.urDdiTable.EnqueueExp; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_tracing_layer::context.version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_tracing_layer::context.version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + dditable.pfnCooperativeKernelLaunchExp = + pDdiTable->pfnCooperativeKernelLaunchExp; + pDdiTable->pfnCooperativeKernelLaunchExp = + ur_tracing_layer::urEnqueueCooperativeKernelLaunchExp; + + return result; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses /// @@ -6380,6 +6508,41 @@ __urdlllocal ur_result_t UR_APICALL urGetKernelProcAddrTable( return result; } /////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's KernelExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +__urdlllocal ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_kernel_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + auto &dditable = ur_tracing_layer::context.urDdiTable.KernelExp; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_tracing_layer::context.version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_tracing_layer::context.version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + dditable.pfnSuggestMaxCooperativeGroupCountExp = + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp; + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = + ur_tracing_layer::urKernelSuggestMaxCooperativeGroupCountExp; + + return result; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses /// @@ -6993,6 +7156,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Enqueue); } + if (UR_RESULT_SUCCESS == result) { + result = ur_tracing_layer::urGetEnqueueExpProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->EnqueueExp); + } + if (UR_RESULT_SUCCESS == result) { result = ur_tracing_layer::urGetEventProcAddrTable( UR_API_VERSION_CURRENT, &dditable->Event); @@ -7003,6 +7171,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Kernel); } + if (UR_RESULT_SUCCESS == result) { + result = ur_tracing_layer::urGetKernelExpProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->KernelExp); + } + if (UR_RESULT_SUCCESS == result) { result = ur_tracing_layer::urGetMemProcAddrTable(UR_API_VERSION_CURRENT, &dditable->Mem); diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index fe689c8537..e170ba04b5 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7142,6 +7142,106 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp +__urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t + workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t * + pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t * + pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t * + pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t * + phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t * + phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. +) { + auto pfnCooperativeKernelLaunchExp = + context.urDdiTable.EnqueueExp.pfnCooperativeKernelLaunchExp; + + if (nullptr == pfnCooperativeKernelLaunchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hQueue) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hKernel) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pGlobalWorkOffset) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (NULL == pGlobalWorkSize) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (phEventWaitList == NULL && numEventsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + + if (phEventWaitList != NULL && numEventsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + + ur_result_t result = pfnCooperativeKernelLaunchExp( + hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, + pLocalWorkSize, numEventsInWaitList, phEventWaitList, phEvent); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp +__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups +) { + auto pfnSuggestMaxCooperativeGroupCountExp = + context.urDdiTable.KernelExp.pfnSuggestMaxCooperativeGroupCountExp; + + if (nullptr == pfnSuggestMaxCooperativeGroupCountExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hKernel) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pGroupCountRet) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + } + + ur_result_t result = + pfnSuggestMaxCooperativeGroupCountExp(hKernel, pGroupCountRet); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -7727,6 +7827,42 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's EnqueueExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_enqueue_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + auto &dditable = ur_validation_layer::context.urDdiTable.EnqueueExp; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_validation_layer::context.version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_validation_layer::context.version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + dditable.pfnCooperativeKernelLaunchExp = + pDdiTable->pfnCooperativeKernelLaunchExp; + pDdiTable->pfnCooperativeKernelLaunchExp = + ur_validation_layer::urEnqueueCooperativeKernelLaunchExp; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses @@ -7865,6 +8001,42 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's KernelExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_kernel_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + auto &dditable = ur_validation_layer::context.urDdiTable.KernelExp; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_validation_layer::context.version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_validation_layer::context.version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + dditable.pfnSuggestMaxCooperativeGroupCountExp = + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp; + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = + ur_validation_layer::urKernelSuggestMaxCooperativeGroupCountExp; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses @@ -8505,6 +8677,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Enqueue); } + if (UR_RESULT_SUCCESS == result) { + result = ur_validation_layer::urGetEnqueueExpProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->EnqueueExp); + } + if (UR_RESULT_SUCCESS == result) { result = ur_validation_layer::urGetEventProcAddrTable( UR_API_VERSION_CURRENT, &dditable->Event); @@ -8515,6 +8692,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Kernel); } + if (UR_RESULT_SUCCESS == result) { + result = ur_validation_layer::urGetKernelExpProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->KernelExp); + } + if (UR_RESULT_SUCCESS == result) { result = ur_validation_layer::urGetMemProcAddrTable( UR_API_VERSION_CURRENT, &dditable->Mem); diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 7094cb0304..528b2d1eba 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6846,6 +6846,109 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urEnqueueCooperativeKernelLaunchExp +__urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t + workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t * + pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t * + pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t * + pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t * + phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t * + phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hQueue)->dditable; + auto pfnCooperativeKernelLaunchExp = + dditable->ur.EnqueueExp.pfnCooperativeKernelLaunchExp; + if (nullptr == pfnCooperativeKernelLaunchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hQueue = reinterpret_cast(hQueue)->handle; + + // convert loader handle to platform handle + hKernel = reinterpret_cast(hKernel)->handle; + + // convert loader handles to platform handles + auto phEventWaitListLocal = + std::vector(numEventsInWaitList); + for (size_t i = 0; i < numEventsInWaitList; ++i) { + phEventWaitListLocal[i] = + reinterpret_cast(phEventWaitList[i])->handle; + } + + // forward to device-platform + result = pfnCooperativeKernelLaunchExp( + hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, + pLocalWorkSize, numEventsInWaitList, phEventWaitListLocal.data(), + phEvent); + + if (UR_RESULT_SUCCESS != result) { + return result; + } + + try { + // convert platform handle to loader handle + if (nullptr != phEvent) { + *phEvent = reinterpret_cast( + ur_event_factory.getInstance(*phEvent, dditable)); + } + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urKernelSuggestMaxCooperativeGroupCountExp +__urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hKernel)->dditable; + auto pfnSuggestMaxCooperativeGroupCountExp = + dditable->ur.KernelExp.pfnSuggestMaxCooperativeGroupCountExp; + if (nullptr == pfnSuggestMaxCooperativeGroupCountExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hKernel = reinterpret_cast(hKernel)->handle; + + // forward to device-platform + result = pfnSuggestMaxCooperativeGroupCountExp(hKernel, pGroupCountRet); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -7376,6 +7479,61 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's EnqueueExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_enqueue_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (ur_loader::context->version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + // Load the device-platform DDI tables + for (auto &platform : ur_loader::context->platforms) { + if (platform.initStatus != UR_RESULT_SUCCESS) { + continue; + } + auto getTable = reinterpret_cast( + ur_loader::LibLoader::getFunctionPtr( + platform.handle.get(), "urGetEnqueueExpProcAddrTable")); + if (!getTable) { + continue; + } + platform.initStatus = + getTable(version, &platform.dditable.ur.EnqueueExp); + } + + if (UR_RESULT_SUCCESS == result) { + if (ur_loader::context->platforms.size() != 1 || + ur_loader::context->forceIntercept) { + // return pointers to loader's DDIs + pDdiTable->pfnCooperativeKernelLaunchExp = + ur_loader::urEnqueueCooperativeKernelLaunchExp; + } else { + // return pointers directly to platform's DDIs + *pDdiTable = + ur_loader::context->platforms.front().dditable.ur.EnqueueExp; + } + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Event table /// with current process' addresses @@ -7506,6 +7664,61 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's KernelExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_kernel_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (ur_loader::context->version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + // Load the device-platform DDI tables + for (auto &platform : ur_loader::context->platforms) { + if (platform.initStatus != UR_RESULT_SUCCESS) { + continue; + } + auto getTable = reinterpret_cast( + ur_loader::LibLoader::getFunctionPtr( + platform.handle.get(), "urGetKernelExpProcAddrTable")); + if (!getTable) { + continue; + } + platform.initStatus = + getTable(version, &platform.dditable.ur.KernelExp); + } + + if (UR_RESULT_SUCCESS == result) { + if (ur_loader::context->platforms.size() != 1 || + ur_loader::context->forceIntercept) { + // return pointers to loader's DDIs + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = + ur_loader::urKernelSuggestMaxCooperativeGroupCountExp; + } else { + // return pointers directly to platform's DDIs + *pDdiTable = + ur_loader::context->platforms.front().dditable.ur.KernelExp; + } + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Mem table /// with current process' addresses diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index dced46e279..c834293bb5 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7654,6 +7654,103 @@ ur_result_t UR_APICALL urCommandBufferEnqueueExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to execute a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t + workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t * + pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t * + pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t * + pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t * + phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t * + phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. + ) try { + auto pfnCooperativeKernelLaunchExp = + ur_lib::context->urDdiTable.EnqueueExp.pfnCooperativeKernelLaunchExp; + if (nullptr == pfnCooperativeKernelLaunchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnCooperativeKernelLaunchExp( + hQueue, hKernel, workDim, pGlobalWorkOffset, pGlobalWorkSize, + pLocalWorkSize, numEventsInWaitList, phEventWaitList, phEvent); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query the maximum number of work groups for a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGroupCountRet` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups + ) try { + auto pfnSuggestMaxCooperativeGroupCountExp = + ur_lib::context->urDdiTable.KernelExp + .pfnSuggestMaxCooperativeGroupCountExp; + if (nullptr == pfnSuggestMaxCooperativeGroupCountExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnSuggestMaxCooperativeGroupCountExp(hKernel, pGroupCountRet); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Import memory into USM /// diff --git a/source/loader/ur_libddi.cpp b/source/loader/ur_libddi.cpp index 912449b54e..9d0a2566f4 100644 --- a/source/loader/ur_libddi.cpp +++ b/source/loader/ur_libddi.cpp @@ -45,6 +45,11 @@ __urdlllocal ur_result_t context_t::urLoaderInit() { &urDdiTable.Enqueue); } + if (UR_RESULT_SUCCESS == result) { + result = urGetEnqueueExpProcAddrTable(UR_API_VERSION_CURRENT, + &urDdiTable.EnqueueExp); + } + if (UR_RESULT_SUCCESS == result) { result = urGetEventProcAddrTable(UR_API_VERSION_CURRENT, &urDdiTable.Event); @@ -55,6 +60,11 @@ __urdlllocal ur_result_t context_t::urLoaderInit() { &urDdiTable.Kernel); } + if (UR_RESULT_SUCCESS == result) { + result = urGetKernelExpProcAddrTable(UR_API_VERSION_CURRENT, + &urDdiTable.KernelExp); + } + if (UR_RESULT_SUCCESS == result) { result = urGetMemProcAddrTable(UR_API_VERSION_CURRENT, &urDdiTable.Mem); } diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 4bc1cc2889..9a66ab92e3 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6459,6 +6459,86 @@ ur_result_t UR_APICALL urCommandBufferEnqueueExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Enqueue a command to execute a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hQueue` +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGlobalWorkOffset` +/// + `NULL == pGlobalWorkSize` +/// - ::UR_RESULT_ERROR_INVALID_QUEUE +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +/// - ::UR_RESULT_ERROR_INVALID_EVENT +/// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST +/// + `phEventWaitList == NULL && numEventsInWaitList > 0` +/// + `phEventWaitList != NULL && numEventsInWaitList == 0` +/// + If event objects in phEventWaitList are not valid events. +/// - ::UR_RESULT_ERROR_INVALID_WORK_DIMENSION +/// - ::UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE +/// - ::UR_RESULT_ERROR_INVALID_VALUE +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t + workDim, ///< [in] number of dimensions, from 1 to 3, to specify the global and + ///< work-group work-items + const size_t * + pGlobalWorkOffset, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< offset used to calculate the global ID of a work-item + const size_t * + pGlobalWorkSize, ///< [in] pointer to an array of workDim unsigned values that specify the + ///< number of global work-items in workDim that will execute the kernel + ///< function + const size_t * + pLocalWorkSize, ///< [in][optional] pointer to an array of workDim unsigned values that + ///< specify the number of local work-items forming a work-group that will + ///< execute the kernel function. + ///< If nullptr, the runtime implementation will choose the work-group + ///< size. + uint32_t numEventsInWaitList, ///< [in] size of the event wait list + const ur_event_handle_t * + phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of + ///< events that must be complete before the kernel execution. + ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait + ///< event. + ur_event_handle_t * + phEvent ///< [out][optional] return an event object that identifies this particular + ///< kernel execution instance. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Query the maximum number of work groups for a cooperative kernel +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hKernel` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pGroupCountRet` +/// - ::UR_RESULT_ERROR_INVALID_KERNEL +ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( + ur_kernel_handle_t hKernel, ///< [in] handle of the kernel object + uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Import memory into USM /// From 5640ea63f5995a0636ff1f264a8c17b73a26cfef Mon Sep 17 00:00:00 2001 From: Sean Stirling Date: Wed, 6 Sep 2023 16:24:14 +0100 Subject: [PATCH 028/145] [Bindless] Struct for unique addressing modes per dimension --- include/ur.py | 17 +++++++++++ include/ur_api.h | 17 +++++++++++ scripts/core/EXP-BINDLESS-IMAGES.rst | 4 +++ scripts/core/exp-bindless-images.yml | 22 ++++++++++++++ source/common/ur_params.hpp | 43 ++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+) diff --git a/include/ur.py b/include/ur.py index 6860304683..a1f4f0fd2d 100644 --- a/include/ur.py +++ b/include/ur.py @@ -250,6 +250,7 @@ class ur_structure_type_v(IntEnum): EXP_FILE_DESCRIPTOR = 0x2003 ## ::ur_exp_file_descriptor_t EXP_WIN32_HANDLE = 0x2004 ## ::ur_exp_win32_handle_t EXP_LAYERED_IMAGE_PROPERTIES = 0x2005 ## ::ur_exp_layered_image_properties_t + EXP_SAMPLER_ADDR_MODES = 0x2006 ## ::ur_exp_sampler_addr_modes_t class ur_structure_type_t(c_int): def __str__(self): @@ -2216,6 +2217,22 @@ class ur_exp_sampler_mip_properties_t(Structure): ("mipFilterMode", ur_sampler_filter_mode_t) ## [in] mipmap filter mode used for filtering between mipmap levels ] +############################################################################### +## @brief Describes unique sampler addressing mode per dimension +## +## @details +## - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t +## as part of a `pNext` chain. +class ur_exp_sampler_addr_modes_t(Structure): + _fields_ = [ + ("stype", ur_structure_type_t), ## [in] type of this structure, must be + ## ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES + ("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure + ("addrModeX", ur_sampler_addressing_mode_t), ## [in] Specify the addressing mode of the x-dimension. + ("addrModeY", ur_sampler_addressing_mode_t), ## [in] Specify the addressing mode of the y-dimension. + ("addrModeZ", ur_sampler_addressing_mode_t) ## [in] Specify the addressing mode of the z-dimension. + ] + ############################################################################### ## @brief Describes an interop memory resource descriptor class ur_exp_interop_mem_desc_t(Structure): diff --git a/include/ur_api.h b/include/ur_api.h index 84d26d1c31..58b8454194 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -259,6 +259,7 @@ typedef enum ur_structure_type_t { UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES = 0x2005, ///< ::ur_exp_layered_image_properties_t + UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2006, ///< ::ur_exp_sampler_addr_modes_t /// @cond UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -7037,6 +7038,22 @@ typedef struct ur_exp_sampler_mip_properties_t { } ur_exp_sampler_mip_properties_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Describes unique sampler addressing mode per dimension +/// +/// @details +/// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t +/// as part of a `pNext` chain. +typedef struct ur_exp_sampler_addr_modes_t { + ur_structure_type_t stype; ///< [in] type of this structure, must be + ///< ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES + void *pNext; ///< [in,out][optional] pointer to extension-specific structure + ur_sampler_addressing_mode_t addrModeX; ///< [in] Specify the addressing mode of the x-dimension. + ur_sampler_addressing_mode_t addrModeY; ///< [in] Specify the addressing mode of the y-dimension. + ur_sampler_addressing_mode_t addrModeZ; ///< [in] Specify the addressing mode of the z-dimension. + +} ur_exp_sampler_addr_modes_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Describes an interop memory resource descriptor typedef struct ur_exp_interop_mem_desc_t { diff --git a/scripts/core/EXP-BINDLESS-IMAGES.rst b/scripts/core/EXP-BINDLESS-IMAGES.rst index 03a31537f3..c794c199d9 100644 --- a/scripts/core/EXP-BINDLESS-IMAGES.rst +++ b/scripts/core/EXP-BINDLESS-IMAGES.rst @@ -69,6 +69,7 @@ Enums ${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR ${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE ${X}_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES + ${X}_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES * ${x}_device_info_t * ${X}_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP @@ -129,6 +130,7 @@ Types * ${x}_exp_file_descriptor_t * ${x}_exp_win32_handle_t * ${x}_exp_layered_image_properties_t +* ${x}_exp_sampler_addr_modes_t Functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -180,6 +182,8 @@ Changelog +----------+-------------------------------------------------------------+ | 7.0 | Add layered image properties struct. | +----------+-------------------------------------------------------------+ +| 8.0 | Added structure for sampler addressing modes per dimension. | ++------------------------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index ef18244a6d..fe74fb1c5c 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -110,6 +110,9 @@ etors: - name: EXP_LAYERED_IMAGE_PROPERTIES desc: $x_exp_layered_image_properties_t value: "0x2005" + - name: EXP_SAMPLER_ADDR_MODES + desc: $x_exp_sampler_addr_modes_t + value: "0x2006" --- #-------------------------------------------------------------------------- type: enum extend: true @@ -176,6 +179,25 @@ members: desc: "[in] mipmap filter mode used for filtering between mipmap levels" --- #-------------------------------------------------------------------------- type: struct +desc: "Describes unique sampler addressing mode per dimension" +details: + - Specify these properties in $xSamplerCreate via $x_sampler_desc_t as part + of a `pNext` chain. +class: $xBindlessImages +name: $x_exp_sampler_addr_modes_t +base: $x_base_properties_t +members: + - type: $x_sampler_addressing_mode_t + name: addrModeX + desc: "[in] Specify the addressing mode of the x-dimension." + - type: $x_sampler_addressing_mode_t + name: addrModeY + desc: "[in] Specify the addressing mode of the y-dimension." + - type: $x_sampler_addressing_mode_t + name: addrModeZ + desc: "[in] Specify the addressing mode of the z-dimension." +--- #-------------------------------------------------------------------------- +type: struct desc: "Describes an interop memory resource descriptor" class: $xBindlessImages name: $x_exp_interop_mem_desc_t diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 4296606987..b852c72e7c 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -432,6 +432,8 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_sampler_mip_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params); inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_mem_desc_t params); inline std::ostream & @@ -1333,6 +1335,10 @@ inline std::ostream &operator<<(std::ostream &os, case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: os << "UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES"; break; + + case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: + os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES"; + break; default: os << "unknown enumerator"; break; @@ -1587,6 +1593,12 @@ inline void serializeStruct(std::ostream &os, const void *ptr) { (const ur_exp_layered_image_properties_t *)ptr; ur_params::serializePtr(os, pstruct); } break; + + case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: { + const ur_exp_sampler_addr_modes_t *pstruct = + (const ur_exp_sampler_addr_modes_t *)ptr; + ur_params::serializePtr(os, pstruct); + } break; default: os << "unknown enumerator"; break; @@ -9879,6 +9891,37 @@ operator<<(std::ostream &os, os << "}"; return os; } +inline std::ostream & +operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { + os << "(struct ur_exp_sampler_addr_modes_t){"; + + os << ".stype = "; + + os << (params.stype); + + os << ", "; + os << ".pNext = "; + + ur_params::serializeStruct(os, (params.pNext)); + + os << ", "; + os << ".addrModeX = "; + + os << (params.addrModeX); + + os << ", "; + os << ".addrModeY = "; + + os << (params.addrModeY); + + os << ", "; + os << ".addrModeZ = "; + + os << (params.addrModeZ); + + os << "}"; + return os; +} inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_mem_desc_t params) { os << "(struct ur_exp_interop_mem_desc_t){"; From 494233bd4aeaad50fca96eadab936889bf00322c Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Fri, 15 Sep 2023 10:06:26 +0100 Subject: [PATCH 029/145] [UR] Check for unused parameters --- cmake/helpers.cmake | 1 + examples/hello_world/hello_world.cpp | 2 +- scripts/templates/params.hpp.mako | 4 +- source/adapters/null/ur_null.cpp | 35 +- .../src/memory_pool_default.c | 10 +- .../src/memory_tracker_windows.cpp | 3 +- source/common/ur_params.hpp | 1048 +++++++++-------- source/common/ur_singleton.hpp | 3 +- source/loader/ur_lib.cpp | 2 +- test/conformance/event/urEventSetCallback.cpp | 17 +- test/conformance/source/environment.cpp | 4 +- test/loader/platforms/platforms.cpp | 2 +- test/unified_malloc_framework/common/pool.hpp | 9 +- .../common/provider.hpp | 18 +- .../memoryPoolAPI.cpp | 8 +- .../umf_pools/disjoint_pool.cpp | 3 +- 16 files changed, 649 insertions(+), 520 deletions(-) diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake index d1e1ae25e3..dcd0d65cef 100644 --- a/cmake/helpers.cmake +++ b/cmake/helpers.cmake @@ -64,6 +64,7 @@ function(add_ur_target_compile_options name) -Wall -Wpedantic -Wempty-body + -Wunused-parameter $<$:-fdiagnostics-color=always> $<$:-fcolor-diagnostics> ) diff --git a/examples/hello_world/hello_world.cpp b/examples/hello_world/hello_world.cpp index 11e5374390..a36b863a3a 100644 --- a/examples/hello_world/hello_world.cpp +++ b/examples/hello_world/hello_world.cpp @@ -15,7 +15,7 @@ #include "ur_api.h" ////////////////////////////////////////////////////////////////////////// -int main(int argc, char *argv[]) { +int main([[maybe_unused]] int argc, [[maybe_unused]] char *argv[]) { ur_result_t status; // Initialize the platform diff --git a/scripts/templates/params.hpp.mako b/scripts/templates/params.hpp.mako index de971c481f..3c13ac11ab 100644 --- a/scripts/templates/params.hpp.mako +++ b/scripts/templates/params.hpp.mako @@ -144,7 +144,7 @@ template inline void serializeTagged(std::ostream &os, const void * %if re.match(r"enum", obj['type']): inline std::ostream &operator<<(std::ostream &os, enum ${th.make_enum_name(n, tags, obj)} value); %elif re.match(r"struct", obj['type']): - inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params); + inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ${obj['type']} ${th.make_type_name(n, tags, obj)} params); %endif %endfor # obj in spec['objects'] %endfor @@ -353,7 +353,7 @@ for item in obj['members']: %for tbl in th.get_pfncbtables(specs, meta, n, tags): %for obj in tbl['functions']: -inline std::ostream &operator<<(std::ostream &os, const struct ${th.make_pfncb_param_type(n, tags, obj)} *params) { +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ${th.make_pfncb_param_type(n, tags, obj)} *params) { <% params_dict = dict() for item in obj['params']: diff --git a/source/adapters/null/ur_null.cpp b/source/adapters/null/ur_null.cpp index 18c8d89ef5..7128a452b2 100644 --- a/source/adapters/null/ur_null.cpp +++ b/source/adapters/null/ur_null.cpp @@ -38,21 +38,21 @@ context_t::context_t() { return UR_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// - urDdiTable.Platform.pfnGet = [](ur_adapter_handle_t *phAdapters, - uint32_t NumAdapters, uint32_t NumEntries, - ur_platform_handle_t *phPlatforms, - uint32_t *pNumPlatforms) { - if (phPlatforms != nullptr && NumEntries != 1) { - return UR_RESULT_ERROR_INVALID_SIZE; - } - if (pNumPlatforms != nullptr) { - *pNumPlatforms = 1; - } - if (nullptr != phPlatforms) { - *reinterpret_cast(phPlatforms) = d_context.get(); - } - return UR_RESULT_SUCCESS; - }; + urDdiTable.Platform.pfnGet = + []([[maybe_unused]] ur_adapter_handle_t *phAdapters, + [[maybe_unused]] uint32_t NumAdapters, uint32_t NumEntries, + ur_platform_handle_t *phPlatforms, uint32_t *pNumPlatforms) { + if (phPlatforms != nullptr && NumEntries != 1) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + if (pNumPlatforms != nullptr) { + *pNumPlatforms = 1; + } + if (nullptr != phPlatforms) { + *reinterpret_cast(phPlatforms) = d_context.get(); + } + return UR_RESULT_SUCCESS; + }; ////////////////////////////////////////////////////////////////////////// urDdiTable.Platform.pfnGetApiVersion = [](ur_platform_handle_t, @@ -122,8 +122,9 @@ context_t::context_t() { ////////////////////////////////////////////////////////////////////////// urDdiTable.Device.pfnGetInfo = - [](ur_device_handle_t hDevice, ur_device_info_t infoType, - size_t propSize, void *pDeviceInfo, size_t *pPropSizeRet) { + []([[maybe_unused]] ur_device_handle_t hDevice, + ur_device_info_t infoType, size_t propSize, void *pDeviceInfo, + size_t *pPropSizeRet) { switch (infoType) { case UR_DEVICE_INFO_TYPE: if (pDeviceInfo && propSize != sizeof(ur_device_type_t)) { diff --git a/source/common/unified_malloc_framework/src/memory_pool_default.c b/source/common/unified_malloc_framework/src/memory_pool_default.c index be7c4c9c57..b997b090cd 100644 --- a/source/common/unified_malloc_framework/src/memory_pool_default.c +++ b/source/common/unified_malloc_framework/src/memory_pool_default.c @@ -69,9 +69,15 @@ void umfPoolDestroy(umf_memory_pool_handle_t hPool) { free(hPool); } -enum umf_result_t umfFree(void *ptr) { return UMF_RESULT_ERROR_NOT_SUPPORTED; } +enum umf_result_t umfFree(void *ptr) { + (void)ptr; + return UMF_RESULT_ERROR_NOT_SUPPORTED; +} -umf_memory_pool_handle_t umfPoolByPtr(const void *ptr) { return NULL; } +umf_memory_pool_handle_t umfPoolByPtr(const void *ptr) { + (void)ptr; + return NULL; +} enum umf_result_t umfPoolGetMemoryProviders(umf_memory_pool_handle_t hPool, size_t numProviders, diff --git a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp index 74cfec7e42..09c483b7eb 100644 --- a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp +++ b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp @@ -15,7 +15,8 @@ #if defined(UMF_SHARED_LIBRARY) critnib *TRACKER = NULL; -BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { +BOOL APIENTRY DllMain([[maybe_unused]] HINSTANCE hinstDLL, DWORD fdwReason, + LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { critnib_delete(TRACKER); } else if (fdwReason == DLL_PROCESS_ATTACH) { diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index b852c72e7c..d1bda365b2 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -224,14 +224,18 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_structure_type_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_base_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_base_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_rect_offset_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_rect_region_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_base_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_base_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_rect_offset_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_rect_region_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_device_init_flag_t value); inline std::ostream &operator<<(std::ostream &os, @@ -242,13 +246,14 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream &operator<<(std::ostream &os, enum ur_platform_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value); -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_platform_native_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_platform_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_platform_backend_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_device_binary_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_binary_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value); inline std::ostream &operator<<(std::ostream &os, @@ -257,10 +262,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_partition_t value); inline std::ostream & operator<<(std::ostream &os, - const struct ur_device_partition_property_t params); -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_partition_properties_t params); + [[maybe_unused]] const struct ur_device_partition_property_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_partition_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_device_fp_capability_flag_t value); inline std::ostream &operator<<(std::ostream &os, @@ -270,7 +275,8 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream &operator<<(std::ostream &os, enum ur_device_exec_capability_flag_t value); inline std::ostream & -operator<<(std::ostream &os, const struct ur_device_native_properties_t params); +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_memory_order_capability_flag_t value); inline std::ostream &operator<<(std::ostream &os, @@ -278,12 +284,13 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, enum ur_device_usm_access_capability_flag_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_context_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_context_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_context_info_t value); inline std::ostream & operator<<(std::ostream &os, - const struct ur_context_native_properties_t params); + [[maybe_unused]] const struct ur_context_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value); @@ -292,34 +299,40 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream &operator<<(std::ostream &os, enum ur_image_channel_type_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_image_format_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_image_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_buffer_properties_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_buffer_channel_properties_t params); + [[maybe_unused]] const struct ur_image_format_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_buffer_alloc_location_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_buffer_region_t params); + [[maybe_unused]] const struct ur_image_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_buffer_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_buffer_channel_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_buffer_alloc_location_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_buffer_region_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_buffer_create_type_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_mem_native_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_sampler_filter_mode_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_sampler_addressing_mode_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_sampler_info_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_sampler_desc_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_sampler_native_properties_t params); + [[maybe_unused]] const struct ur_sampler_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_usm_host_mem_flag_t value); inline std::ostream &operator<<(std::ostream &os, @@ -331,16 +344,21 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_usm_alloc_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_usm_advice_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_host_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_device_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_pool_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_pool_limits_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_host_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_device_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_desc_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_usm_pool_info_t value); inline std::ostream &operator<<(std::ostream &os, @@ -352,13 +370,16 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_flag_t value); inline std::ostream & -operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params); +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_program_metadata_type_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_program_metadata_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_program_properties_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_metadata_t params); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_program_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_program_build_status_t value); @@ -366,18 +387,18 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_program_binary_type_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_program_build_info_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_specialization_constant_info_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_specialization_constant_info_t params); -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_program_native_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_value_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_local_properties_t params); + [[maybe_unused]] const struct ur_program_native_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_value_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_local_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_group_info_t value); @@ -387,37 +408,43 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_cache_config_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_exec_info_t value); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_pointer_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_exec_info_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_sampler_properties_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_arg_mem_obj_properties_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_kernel_arg_pointer_properties_t params); + [[maybe_unused]] const struct ur_kernel_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value); +inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value); inline std::ostream & operator<<(std::ostream &os, - const struct ur_kernel_exec_info_properties_t params); + [[maybe_unused]] const struct ur_queue_properties_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_kernel_arg_sampler_properties_t params); + [[maybe_unused]] const struct ur_queue_index_properties_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_kernel_arg_mem_obj_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, const struct ur_kernel_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, const struct ur_queue_index_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_native_desc_t params); + [[maybe_unused]] const struct ur_queue_native_desc_t params); inline std::ostream & -operator<<(std::ostream &os, const struct ur_queue_native_properties_t params); +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_event_status_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_profiling_info_t value); inline std::ostream & -operator<<(std::ostream &os, const struct ur_event_native_properties_t params); +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_native_properties_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_execution_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value); @@ -425,10 +452,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_usm_migration_flag_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_exp_image_copy_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_exp_file_descriptor_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_exp_win32_handle_t params); inline std::ostream & operator<<(std::ostream &os, const struct ur_exp_sampler_mip_properties_t params); @@ -438,12 +461,22 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_mem_desc_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_exp_interop_semaphore_desc_t params); + [[maybe_unused]] const struct ur_exp_win32_handle_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); inline std::ostream & operator<<(std::ostream &os, - const struct ur_exp_layered_image_properties_t params); + [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params); +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_exp_layered_image_properties_t params); inline std::ostream & -operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params); +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_exp_peer_info_t value); @@ -10055,8 +10088,9 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } } // namespace ur_params -inline std::ostream &operator<<(std::ostream &os, - const struct ur_adapter_get_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_get_params_t *params) { os << ".NumEntries = "; @@ -10083,7 +10117,8 @@ inline std::ostream &operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_adapter_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_release_params_t *params) { os << ".hAdapter = "; @@ -10093,7 +10128,8 @@ operator<<(std::ostream &os, const struct ur_adapter_release_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_adapter_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_adapter_retain_params_t *params) { os << ".hAdapter = "; @@ -10102,9 +10138,9 @@ operator<<(std::ostream &os, const struct ur_adapter_retain_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_adapter_get_last_error_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_adapter_get_last_error_params_t *params) { os << ".hAdapter = "; @@ -10125,7 +10161,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_adapter_get_info_params_t *params) { + [[maybe_unused]] const struct ur_adapter_get_info_params_t *params) { os << ".hAdapter = "; @@ -10155,9 +10191,8 @@ operator<<(std::ostream &os, } inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t - *params) { + std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params) { os << ".hContext = "; @@ -10177,9 +10212,8 @@ inline std::ostream &operator<<( } inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_sampled_image_handle_destroy_exp_params_t - *params) { + std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_sampled_image_handle_destroy_exp_params_t *params) { os << ".hContext = "; @@ -10200,7 +10234,8 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_bindless_images_image_allocate_exp_params_t *params) { + [[maybe_unused]] const struct ur_bindless_images_image_allocate_exp_params_t + *params) { os << ".hContext = "; @@ -10229,9 +10264,10 @@ inline std::ostream &operator<<( return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_bindless_images_image_free_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_free_exp_params_t + *params) { os << ".hContext = "; @@ -10251,9 +10287,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, - const struct ur_bindless_images_unsampled_image_create_exp_params_t - *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_unsampled_image_create_exp_params_t *params) { os << ".hContext = "; @@ -10292,9 +10327,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_sampled_image_create_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_sampled_image_create_exp_params_t *params) { os << ".hContext = "; @@ -10338,9 +10373,10 @@ inline std::ostream &operator<<( return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_bindless_images_image_copy_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_image_copy_exp_params_t + *params) { os << ".hQueue = "; @@ -10420,7 +10456,8 @@ operator<<(std::ostream &os, inline std::ostream &operator<<( std::ostream &os, - const struct ur_bindless_images_image_get_info_exp_params_t *params) { + [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t + *params) { os << ".hImageMem = "; @@ -10444,9 +10481,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_mipmap_get_level_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_mipmap_get_level_exp_params_t *params) { os << ".hContext = "; @@ -10475,9 +10512,10 @@ inline std::ostream &operator<<( return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_bindless_images_mipmap_free_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_bindless_images_mipmap_free_exp_params_t + *params) { os << ".hContext = "; @@ -10496,9 +10534,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_import_opaque_fd_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_import_opaque_fd_exp_params_t *params) { os << ".hContext = "; @@ -10527,9 +10565,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_map_external_array_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_map_external_array_exp_params_t *params) { os << ".hContext = "; @@ -10563,9 +10601,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_release_interop_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_release_interop_exp_params_t *params) { os << ".hContext = "; @@ -10585,7 +10623,7 @@ inline std::ostream &operator<<( } inline std::ostream & -operator<<(std::ostream &os, const struct +operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_import_external_semaphore_opaque_fd_exp_params_t *params) { @@ -10611,10 +10649,9 @@ operator<<(std::ostream &os, const struct return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_destroy_external_semaphore_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_destroy_external_semaphore_exp_params_t *params) { os << ".hContext = "; @@ -10634,9 +10671,8 @@ inline std::ostream &operator<<( } inline std::ostream & -operator<<(std::ostream &os, - const struct ur_bindless_images_wait_external_semaphore_exp_params_t - *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_wait_external_semaphore_exp_params_t *params) { os << ".hQueue = "; @@ -10673,10 +10709,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_bindless_images_signal_external_semaphore_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_bindless_images_signal_external_semaphore_exp_params_t *params) { os << ".hQueue = "; @@ -10715,7 +10750,8 @@ inline std::ostream &operator<<( inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_create_exp_params_t *params) { + [[maybe_unused]] const struct ur_command_buffer_create_exp_params_t + *params) { os << ".hContext = "; @@ -10741,7 +10777,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_retain_exp_params_t *params) { + [[maybe_unused]] const struct ur_command_buffer_retain_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10752,7 +10789,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_release_exp_params_t *params) { + [[maybe_unused]] const struct ur_command_buffer_release_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10763,7 +10801,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_finalize_exp_params_t *params) { + [[maybe_unused]] const struct ur_command_buffer_finalize_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10772,9 +10811,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_kernel_launch_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_kernel_launch_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10823,9 +10862,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_usm_memcpy_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_memcpy_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10866,7 +10905,8 @@ inline std::ostream &operator<<( inline std::ostream &operator<<( std::ostream &os, - const struct ur_command_buffer_append_usm_fill_exp_params_t *params) { + [[maybe_unused]] const struct ur_command_buffer_append_usm_fill_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -10911,9 +10951,8 @@ inline std::ostream &operator<<( } inline std::ostream & -operator<<(std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_copy_exp_params_t - *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_copy_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -10963,9 +11002,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_write_exp_params_t - *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_write_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11010,9 +11048,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_read_exp_params_t - *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_read_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11056,10 +11093,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11129,9 +11165,8 @@ inline std::ostream &operator<<( } inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t - *params) { + std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11200,10 +11235,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11273,9 +11307,8 @@ inline std::ostream &operator<<( } inline std::ostream & -operator<<(std::ostream &os, - const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t - *params) { +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_mem_buffer_fill_exp_params_t *params) { os << ".hCommandBuffer = "; @@ -11326,7 +11359,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_command_buffer_enqueue_exp_params_t *params) { + [[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t + *params) { os << ".hCommandBuffer = "; @@ -11364,7 +11398,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_context_create_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_create_params_t *params) { os << ".DeviceCount = "; @@ -11396,7 +11431,8 @@ operator<<(std::ostream &os, const struct ur_context_create_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_context_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_retain_params_t *params) { os << ".hContext = "; @@ -11406,7 +11442,8 @@ operator<<(std::ostream &os, const struct ur_context_retain_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_context_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_context_release_params_t *params) { os << ".hContext = "; @@ -11417,7 +11454,7 @@ operator<<(std::ostream &os, const struct ur_context_release_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_context_get_info_params_t *params) { + [[maybe_unused]] const struct ur_context_get_info_params_t *params) { os << ".hContext = "; @@ -11448,7 +11485,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_context_get_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_context_get_native_handle_params_t + *params) { os << ".hContext = "; @@ -11462,9 +11500,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_context_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_context_create_with_native_handle_params_t + *params) { os << ".hNativeContext = "; @@ -11500,9 +11539,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_context_set_extended_deleter_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_context_set_extended_deleter_params_t + *params) { os << ".hContext = "; @@ -11521,9 +11561,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_kernel_launch_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_kernel_launch_params_t *params) { os << ".hQueue = "; @@ -11580,9 +11620,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_events_wait_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_events_wait_params_t *params) { os << ".hQueue = "; @@ -11614,9 +11654,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_events_wait_with_barrier_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_events_wait_with_barrier_params_t + *params) { os << ".hQueue = "; @@ -11648,9 +11689,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_read_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_params_t *params) { os << ".hQueue = "; @@ -11709,7 +11750,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_write_params_t *params) { + [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_params_t + *params) { os << ".hQueue = "; @@ -11766,9 +11808,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_read_rect_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_rect_params_t + *params) { os << ".hQueue = "; @@ -11850,9 +11893,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_write_rect_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_rect_params_t + *params) { os << ".hQueue = "; @@ -11934,9 +11978,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_copy_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_params_t *params) { os << ".hQueue = "; @@ -11993,9 +12037,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_copy_rect_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_rect_params_t + *params) { os << ".hQueue = "; @@ -12072,9 +12117,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_fill_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_fill_params_t *params) { os << ".hQueue = "; @@ -12131,9 +12176,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_image_read_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_image_read_params_t *params) { os << ".hQueue = "; @@ -12200,9 +12245,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_image_write_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_image_write_params_t *params) { os << ".hQueue = "; @@ -12269,9 +12314,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_image_copy_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_image_copy_params_t *params) { os << ".hQueue = "; @@ -12328,9 +12373,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_buffer_map_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_buffer_map_params_t *params) { os << ".hQueue = "; @@ -12392,9 +12437,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_mem_unmap_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_mem_unmap_params_t *params) { os << ".hQueue = "; @@ -12438,7 +12483,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_enqueue_usm_fill_params_t *params) { + [[maybe_unused]] const struct ur_enqueue_usm_fill_params_t *params) { os << ".hQueue = "; @@ -12490,9 +12535,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_usm_memcpy_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_memcpy_params_t *params) { os << ".hQueue = "; @@ -12544,9 +12589,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_usm_prefetch_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_prefetch_params_t *params) { os << ".hQueue = "; @@ -12593,9 +12638,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_usm_advise_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_advise_params_t *params) { os << ".hQueue = "; @@ -12624,9 +12669,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_usm_fill_2d_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_fill_2d_params_t *params) { os << ".hQueue = "; @@ -12688,9 +12733,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_usm_memcpy_2d_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_usm_memcpy_2d_params_t *params) { os << ".hQueue = "; @@ -12757,9 +12802,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_enqueue_device_global_variable_write_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_device_global_variable_write_params_t *params) { os << ".hQueue = "; @@ -12821,9 +12866,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_enqueue_device_global_variable_read_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_device_global_variable_read_params_t *params) { os << ".hQueue = "; @@ -12885,9 +12930,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_read_host_pipe_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_read_host_pipe_params_t *params) { os << ".hQueue = "; @@ -12944,9 +12989,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_enqueue_write_host_pipe_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_enqueue_write_host_pipe_params_t *params) { os << ".hQueue = "; @@ -13063,7 +13108,8 @@ inline std::ostream &operator<<( } inline std::ostream & -operator<<(std::ostream &os, const struct ur_event_get_info_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_get_info_params_t *params) { os << ".hEvent = "; @@ -13094,7 +13140,8 @@ operator<<(std::ostream &os, const struct ur_event_get_info_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_event_get_profiling_info_params_t *params) { + [[maybe_unused]] const struct ur_event_get_profiling_info_params_t + *params) { os << ".hEvent = "; @@ -13123,8 +13170,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_event_wait_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_wait_params_t *params) { os << ".numEvents = "; @@ -13145,8 +13193,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_event_retain_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_retain_params_t *params) { os << ".hEvent = "; @@ -13156,7 +13205,8 @@ inline std::ostream &operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_event_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_event_release_params_t *params) { os << ".hEvent = "; @@ -13165,9 +13215,9 @@ operator<<(std::ostream &os, const struct ur_event_release_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_event_get_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_event_get_native_handle_params_t *params) { os << ".hEvent = "; @@ -13181,9 +13231,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_event_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_event_create_with_native_handle_params_t + *params) { os << ".hNativeEvent = "; @@ -13207,9 +13258,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_event_set_callback_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_event_set_callback_params_t *params) { os << ".hEvent = "; @@ -13234,7 +13285,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_kernel_create_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_create_params_t *params) { os << ".hProgram = "; @@ -13254,7 +13306,8 @@ operator<<(std::ostream &os, const struct ur_kernel_create_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_kernel_get_info_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_get_info_params_t *params) { os << ".hKernel = "; @@ -13283,9 +13336,9 @@ operator<<(std::ostream &os, const struct ur_kernel_get_info_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_get_group_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_get_group_info_params_t *params) { os << ".hKernel = "; @@ -13321,7 +13374,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_kernel_get_sub_group_info_params_t *params) { + [[maybe_unused]] const struct ur_kernel_get_sub_group_info_params_t + *params) { os << ".hKernel = "; @@ -13356,7 +13410,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_kernel_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_retain_params_t *params) { os << ".hKernel = "; @@ -13366,7 +13421,8 @@ operator<<(std::ostream &os, const struct ur_kernel_retain_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_kernel_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_kernel_release_params_t *params) { os << ".hKernel = "; @@ -13377,7 +13433,8 @@ operator<<(std::ostream &os, const struct ur_kernel_release_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_kernel_get_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_kernel_get_native_handle_params_t + *params) { os << ".hKernel = "; @@ -13391,9 +13448,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_create_with_native_handle_params_t + *params) { os << ".hNativeKernel = "; @@ -13422,9 +13480,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_set_arg_value_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_value_params_t *params) { os << ".hKernel = "; @@ -13453,9 +13511,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_set_arg_local_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_local_params_t *params) { os << ".hKernel = "; @@ -13479,9 +13537,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_set_arg_pointer_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_pointer_params_t *params) { os << ".hKernel = "; @@ -13505,9 +13563,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_set_exec_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_exec_info_params_t *params) { os << ".hKernel = "; @@ -13536,9 +13594,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_set_arg_sampler_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_sampler_params_t *params) { os << ".hKernel = "; @@ -13562,9 +13620,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_set_arg_mem_obj_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_kernel_set_arg_mem_obj_params_t *params) { os << ".hKernel = "; @@ -13588,9 +13646,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_kernel_set_specialization_constants_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_kernel_set_specialization_constants_params_t *params) { os << ".hKernel = "; @@ -13644,14 +13702,14 @@ inline std::ostream &operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_loader_tear_down_params_t *params) { + [[maybe_unused]] const struct ur_loader_tear_down_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_loader_config_create_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_create_params_t *params) { os << ".phLoaderConfig = "; @@ -13660,9 +13718,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_loader_config_retain_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_retain_params_t *params) { os << ".hLoaderConfig = "; @@ -13671,9 +13729,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_loader_config_release_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_release_params_t *params) { os << ".hLoaderConfig = "; @@ -13682,9 +13740,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_loader_config_get_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_loader_config_get_info_params_t *params) { os << ".hLoaderConfig = "; @@ -13715,7 +13773,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_loader_config_enable_layer_params_t *params) { + [[maybe_unused]] const struct ur_loader_config_enable_layer_params_t + *params) { os << ".hLoaderConfig = "; @@ -13731,7 +13790,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_mem_image_create_params_t *params) { + [[maybe_unused]] const struct ur_mem_image_create_params_t *params) { os << ".hContext = "; @@ -13765,9 +13824,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_mem_buffer_create_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_buffer_create_params_t *params) { os << ".hContext = "; @@ -13796,8 +13855,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_mem_retain_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_retain_params_t *params) { os << ".hMem = "; @@ -13806,8 +13866,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_mem_release_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_release_params_t *params) { os << ".hMem = "; @@ -13816,9 +13877,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_mem_buffer_partition_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_buffer_partition_params_t *params) { os << ".hBuffer = "; @@ -13847,9 +13908,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_mem_get_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_get_native_handle_params_t *params) { os << ".hMem = "; @@ -13863,9 +13924,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_mem_buffer_create_with_native_handle_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_mem_buffer_create_with_native_handle_params_t *params) { os << ".hNativeMem = "; @@ -13889,9 +13950,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_mem_image_create_with_native_handle_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_mem_image_create_with_native_handle_params_t *params) { os << ".hNativeMem = "; @@ -13925,8 +13986,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_mem_get_info_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_mem_get_info_params_t *params) { os << ".hMemory = "; @@ -13955,9 +14017,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_mem_image_get_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_mem_image_get_info_params_t *params) { os << ".hMemory = "; @@ -13986,9 +14048,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_physical_mem_create_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_create_params_t *params) { os << ".hContext = "; @@ -14017,9 +14079,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_physical_mem_retain_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_retain_params_t *params) { os << ".hPhysicalMem = "; @@ -14028,9 +14090,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_physical_mem_release_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_physical_mem_release_params_t *params) { os << ".hPhysicalMem = "; @@ -14039,8 +14101,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_platform_get_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_params_t *params) { os << ".phAdapters = {"; for (size_t i = 0; @@ -14083,9 +14146,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_platform_get_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_platform_get_info_params_t *params) { os << ".hPlatform = "; @@ -14116,7 +14179,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_platform_get_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_platform_get_native_handle_params_t + *params) { os << ".hPlatform = "; @@ -14132,7 +14196,8 @@ operator<<(std::ostream &os, inline std::ostream &operator<<( std::ostream &os, - const struct ur_platform_create_with_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_platform_create_with_native_handle_params_t + *params) { os << ".hNativePlatform = "; @@ -14153,7 +14218,8 @@ inline std::ostream &operator<<( inline std::ostream & operator<<(std::ostream &os, - const struct ur_platform_get_api_version_params_t *params) { + [[maybe_unused]] const struct ur_platform_get_api_version_params_t + *params) { os << ".hPlatform = "; @@ -14169,7 +14235,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_platform_get_backend_option_params_t *params) { + [[maybe_unused]] const struct ur_platform_get_backend_option_params_t + *params) { os << ".hPlatform = "; @@ -14188,9 +14255,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_program_create_with_il_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_create_with_il_params_t *params) { os << ".hContext = "; @@ -14221,7 +14288,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_program_create_with_binary_params_t *params) { + [[maybe_unused]] const struct ur_program_create_with_binary_params_t + *params) { os << ".hContext = "; @@ -14256,7 +14324,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_program_build_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_build_params_t *params) { os << ".hContext = "; @@ -14276,7 +14345,8 @@ operator<<(std::ostream &os, const struct ur_program_build_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_program_compile_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_compile_params_t *params) { os << ".hContext = "; @@ -14295,8 +14365,9 @@ operator<<(std::ostream &os, const struct ur_program_compile_params_t *params) { return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_program_link_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_link_params_t *params) { os << ".hContext = "; @@ -14333,7 +14404,8 @@ inline std::ostream &operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_program_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_retain_params_t *params) { os << ".hProgram = "; @@ -14343,7 +14415,8 @@ operator<<(std::ostream &os, const struct ur_program_retain_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_program_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_program_release_params_t *params) { os << ".hProgram = "; @@ -14352,9 +14425,10 @@ operator<<(std::ostream &os, const struct ur_program_release_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_program_get_function_pointer_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_get_function_pointer_params_t + *params) { os << ".hDevice = "; @@ -14380,7 +14454,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_program_get_info_params_t *params) { + [[maybe_unused]] const struct ur_program_get_info_params_t *params) { os << ".hProgram = "; @@ -14409,9 +14483,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_program_get_build_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_get_build_info_params_t *params) { os << ".hProgram = "; @@ -14445,9 +14519,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_program_set_specialization_constants_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_program_set_specialization_constants_params_t *params) { os << ".hProgram = "; @@ -14475,7 +14549,8 @@ inline std::ostream &operator<<( inline std::ostream & operator<<(std::ostream &os, - const struct ur_program_get_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_program_get_native_handle_params_t + *params) { os << ".hProgram = "; @@ -14489,9 +14564,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_program_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_program_create_with_native_handle_params_t + *params) { os << ".hNativeProgram = "; @@ -14516,7 +14592,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_queue_get_info_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_get_info_params_t *params) { os << ".hQueue = "; @@ -14545,8 +14622,9 @@ operator<<(std::ostream &os, const struct ur_queue_get_info_params_t *params) { return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_create_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_create_params_t *params) { os << ".hContext = "; @@ -14570,8 +14648,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_retain_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_retain_params_t *params) { os << ".hQueue = "; @@ -14581,7 +14660,8 @@ inline std::ostream &operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_queue_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_release_params_t *params) { os << ".hQueue = "; @@ -14590,9 +14670,9 @@ operator<<(std::ostream &os, const struct ur_queue_release_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_queue_get_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_queue_get_native_handle_params_t *params) { os << ".hQueue = "; @@ -14611,9 +14691,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_queue_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_queue_create_with_native_handle_params_t + *params) { os << ".hNativeQueue = "; @@ -14642,8 +14723,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_finish_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_finish_params_t *params) { os << ".hQueue = "; @@ -14652,8 +14734,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_flush_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_queue_flush_params_t *params) { os << ".hQueue = "; @@ -14663,7 +14746,8 @@ inline std::ostream &operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_sampler_create_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_create_params_t *params) { os << ".hContext = "; @@ -14683,7 +14767,8 @@ operator<<(std::ostream &os, const struct ur_sampler_create_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_sampler_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_retain_params_t *params) { os << ".hSampler = "; @@ -14693,7 +14778,8 @@ operator<<(std::ostream &os, const struct ur_sampler_retain_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_sampler_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_sampler_release_params_t *params) { os << ".hSampler = "; @@ -14704,7 +14790,7 @@ operator<<(std::ostream &os, const struct ur_sampler_release_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_sampler_get_info_params_t *params) { + [[maybe_unused]] const struct ur_sampler_get_info_params_t *params) { os << ".hSampler = "; @@ -14735,7 +14821,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_sampler_get_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_sampler_get_native_handle_params_t + *params) { os << ".hSampler = "; @@ -14749,9 +14836,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_sampler_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_sampler_create_with_native_handle_params_t + *params) { os << ".hNativeSampler = "; @@ -14776,7 +14864,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_usm_host_alloc_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_host_alloc_params_t *params) { os << ".hContext = "; @@ -14807,7 +14896,7 @@ operator<<(std::ostream &os, const struct ur_usm_host_alloc_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_usm_device_alloc_params_t *params) { + [[maybe_unused]] const struct ur_usm_device_alloc_params_t *params) { os << ".hContext = "; @@ -14843,7 +14932,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_usm_shared_alloc_params_t *params) { + [[maybe_unused]] const struct ur_usm_shared_alloc_params_t *params) { os << ".hContext = "; @@ -14877,8 +14966,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_free_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_free_params_t *params) { os << ".hContext = "; @@ -14892,9 +14982,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_usm_get_mem_alloc_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_get_mem_alloc_info_params_t *params) { os << ".hContext = "; @@ -14929,7 +15019,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_usm_pool_create_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_create_params_t *params) { os << ".hContext = "; @@ -14949,7 +15040,8 @@ operator<<(std::ostream &os, const struct ur_usm_pool_create_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_usm_pool_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_retain_params_t *params) { os << ".pPool = "; @@ -14960,7 +15052,7 @@ operator<<(std::ostream &os, const struct ur_usm_pool_retain_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_usm_pool_release_params_t *params) { + [[maybe_unused]] const struct ur_usm_pool_release_params_t *params) { os << ".pPool = "; @@ -14969,9 +15061,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_usm_pool_get_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pool_get_info_params_t *params) { os << ".hPool = "; @@ -15000,9 +15092,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_usm_pitched_alloc_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_pitched_alloc_exp_params_t *params) { os << ".hContext = "; @@ -15052,7 +15144,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_usm_import_exp_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_import_exp_params_t *params) { os << ".hContext = "; @@ -15072,7 +15165,8 @@ operator<<(std::ostream &os, const struct ur_usm_import_exp_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_usm_release_exp_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_usm_release_exp_params_t *params) { os << ".hContext = "; @@ -15086,9 +15180,10 @@ operator<<(std::ostream &os, const struct ur_usm_release_exp_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_usm_p2p_enable_peer_access_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_p2p_enable_peer_access_exp_params_t + *params) { os << ".commandDevice = "; @@ -15102,9 +15197,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_usm_p2p_disable_peer_access_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_p2p_disable_peer_access_exp_params_t + *params) { os << ".commandDevice = "; @@ -15118,9 +15214,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_usm_p2p_peer_access_get_info_exp_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_usm_p2p_peer_access_get_info_exp_params_t + *params) { os << ".commandDevice = "; @@ -15154,9 +15251,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_virtual_mem_granularity_get_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_granularity_get_info_params_t + *params) { os << ".hContext = "; @@ -15190,9 +15288,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_virtual_mem_reserve_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_reserve_params_t *params) { os << ".hContext = "; @@ -15218,7 +15316,7 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_virtual_mem_free_params_t *params) { + [[maybe_unused]] const struct ur_virtual_mem_free_params_t *params) { os << ".hContext = "; @@ -15238,7 +15336,8 @@ operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_virtual_mem_map_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_map_params_t *params) { os << ".hContext = "; @@ -15273,9 +15372,9 @@ operator<<(std::ostream &os, const struct ur_virtual_mem_map_params_t *params) { return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_virtual_mem_unmap_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_unmap_params_t *params) { os << ".hContext = "; @@ -15294,9 +15393,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_virtual_mem_set_access_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_set_access_params_t *params) { os << ".hContext = "; @@ -15321,9 +15420,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_virtual_mem_get_info_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_virtual_mem_get_info_params_t *params) { os << ".hContext = "; @@ -15362,8 +15461,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_device_get_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_get_params_t *params) { os << ".hPlatform = "; @@ -15400,7 +15500,8 @@ inline std::ostream &operator<<(std::ostream &os, } inline std::ostream & -operator<<(std::ostream &os, const struct ur_device_get_info_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_get_info_params_t *params) { os << ".hDevice = "; @@ -15430,7 +15531,8 @@ operator<<(std::ostream &os, const struct ur_device_get_info_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_device_retain_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_retain_params_t *params) { os << ".hDevice = "; @@ -15440,7 +15542,8 @@ operator<<(std::ostream &os, const struct ur_device_retain_params_t *params) { } inline std::ostream & -operator<<(std::ostream &os, const struct ur_device_release_params_t *params) { +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_device_release_params_t *params) { os << ".hDevice = "; @@ -15451,7 +15554,7 @@ operator<<(std::ostream &os, const struct ur_device_release_params_t *params) { inline std::ostream & operator<<(std::ostream &os, - const struct ur_device_partition_params_t *params) { + [[maybe_unused]] const struct ur_device_partition_params_t *params) { os << ".hDevice = "; @@ -15487,9 +15590,9 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_select_binary_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_select_binary_params_t *params) { os << ".hDevice = "; @@ -15515,7 +15618,8 @@ operator<<(std::ostream &os, inline std::ostream & operator<<(std::ostream &os, - const struct ur_device_get_native_handle_params_t *params) { + [[maybe_unused]] const struct ur_device_get_native_handle_params_t + *params) { os << ".hDevice = "; @@ -15529,9 +15633,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_create_with_native_handle_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_create_with_native_handle_params_t + *params) { os << ".hNativeDevice = "; @@ -15555,9 +15660,10 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_get_global_timestamps_params_t *params) { +inline std::ostream &operator<<( + std::ostream &os, + [[maybe_unused]] const struct ur_device_get_global_timestamps_params_t + *params) { os << ".hDevice = "; diff --git a/source/common/ur_singleton.hpp b/source/common/ur_singleton.hpp index d757bb197c..6440e3ac7f 100644 --- a/source/common/ur_singleton.hpp +++ b/source/common/ur_singleton.hpp @@ -31,7 +31,8 @@ template class singleton_factory_t { ////////////////////////////////////////////////////////////////////////// /// extract the key from parameter list and if necessary, convert type - template key_t getKey(key_tn key, Ts &&...params) { + template + key_t getKey(key_tn key, [[maybe_unused]] Ts &&...params) { return reinterpret_cast(key); } diff --git a/source/loader/ur_lib.cpp b/source/loader/ur_lib.cpp index e1c0ed5e2f..08dc7e491a 100644 --- a/source/loader/ur_lib.cpp +++ b/source/loader/ur_lib.cpp @@ -70,7 +70,7 @@ void context_t::tearDownLayers() const { ////////////////////////////////////////////////////////////////////////// __urdlllocal ur_result_t -context_t::Init(ur_device_init_flags_t device_flags, +context_t::Init([[maybe_unused]] ur_device_init_flags_t device_flags, ur_loader_config_handle_t hLoaderConfig) { ur_result_t result; const char *logger_name = "loader"; diff --git a/test/conformance/event/urEventSetCallback.cpp b/test/conformance/event/urEventSetCallback.cpp index e238b4534d..ffecacc086 100644 --- a/test/conformance/event/urEventSetCallback.cpp +++ b/test/conformance/event/urEventSetCallback.cpp @@ -14,8 +14,9 @@ using urEventSetCallbackTest = uur::event::urEventReferenceTest; TEST_P(urEventSetCallbackTest, Success) { struct Callback { - static void callback(ur_event_handle_t hEvent, - ur_execution_info_t execStatus, void *pUserData) { + static void callback([[maybe_unused]] ur_event_handle_t hEvent, + [[maybe_unused]] ur_execution_info_t execStatus, + void *pUserData) { auto status = reinterpret_cast(pUserData); *status = true; @@ -78,7 +79,7 @@ TEST_P(urEventSetCallbackTest, AllStates) { }; struct Callback { - static void callback(ur_event_handle_t hEvent, + static void callback([[maybe_unused]] ur_event_handle_t hEvent, ur_execution_info_t execStatus, void *pUserData) { auto status = reinterpret_cast(pUserData); @@ -142,8 +143,9 @@ TEST_P(urEventSetCallbackTest, EventAlreadyCompleted) { ASSERT_SUCCESS(urEventWait(1, &event)); struct Callback { - static void callback(ur_event_handle_t hEvent, - ur_execution_info_t execStatus, void *pUserData) { + static void callback([[maybe_unused]] ur_event_handle_t hEvent, + [[maybe_unused]] ur_execution_info_t execStatus, + void *pUserData) { auto status = reinterpret_cast(pUserData); *status = true; @@ -165,8 +167,9 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEventSetCallbackTest); /* Negative tests */ using urEventSetCallbackNegativeTest = uur::event::urEventTest; -void emptyCallback(ur_event_handle_t hEvent, ur_execution_info_t execStatus, - void *pUserData) {} +void emptyCallback([[maybe_unused]] ur_event_handle_t hEvent, + [[maybe_unused]] ur_execution_info_t execStatus, + [[maybe_unused]] void *pUserData) {} TEST_P(urEventSetCallbackNegativeTest, InvalidNullHandleEvent) { ASSERT_EQ_RESULT( diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 92b84f4b4d..296bc73bb1 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -356,8 +356,8 @@ void KernelsEnvironment::LoadSource( binary_out = binary_ptr; } -std::vector -KernelsEnvironment::GetEntryPointNames(std::string program_name) { +std::vector KernelsEnvironment::GetEntryPointNames( + [[maybe_unused]] std::string program_name) { std::vector entry_points; #ifdef KERNELS_ENVIRONMENT entry_points = uur::device_binaries::program_kernel_map[program_name]; diff --git a/test/loader/platforms/platforms.cpp b/test/loader/platforms/platforms.cpp index bf85ae9cf4..504cc8404f 100644 --- a/test/loader/platforms/platforms.cpp +++ b/test/loader/platforms/platforms.cpp @@ -18,7 +18,7 @@ using namespace logger; ////////////////////////////////////////////////////////////////////////// -int main(int argc, char *argv[]) { +int main([[maybe_unused]] int argc, [[maybe_unused]] char *argv[]) { logger::init("TEST"); ur_result_t status; diff --git a/test/unified_malloc_framework/common/pool.hpp b/test/unified_malloc_framework/common/pool.hpp index 7a7b650e11..f4ecc7c594 100644 --- a/test/unified_malloc_framework/common/pool.hpp +++ b/test/unified_malloc_framework/common/pool.hpp @@ -76,7 +76,7 @@ struct pool_base { umf_result_t initialize(umf_memory_provider_handle_t *, size_t) noexcept { return UMF_RESULT_SUCCESS; }; - void *malloc(size_t size) noexcept { return nullptr; } + void *malloc([[maybe_unused]] size_t size) noexcept { return nullptr; } void *calloc(size_t, size_t) noexcept { return nullptr; } void *realloc(void *, size_t) noexcept { return nullptr; } void *aligned_malloc(size_t, size_t) noexcept { return nullptr; } @@ -120,7 +120,7 @@ struct malloc_pool : public pool_base { struct proxy_pool : public pool_base { umf_result_t initialize(umf_memory_provider_handle_t *providers, - size_t numProviders) noexcept { + [[maybe_unused]] size_t numProviders) noexcept { this->provider = providers[0]; return UMF_RESULT_SUCCESS; } @@ -136,7 +136,8 @@ struct proxy_pool : public pool_base { } return ptr; } - void *realloc(void *ptr, size_t size) noexcept { + void *realloc([[maybe_unused]] void *ptr, + [[maybe_unused]] size_t size) noexcept { // TODO: not supported umf::getPoolLastStatusRef() = UMF_RESULT_ERROR_NOT_SUPPORTED; @@ -150,7 +151,7 @@ struct proxy_pool : public pool_base { } return ptr; } - size_t malloc_usable_size(void *ptr) noexcept { + size_t malloc_usable_size([[maybe_unused]] void *ptr) noexcept { // TODO: not supported return 0; } diff --git a/test/unified_malloc_framework/common/provider.hpp b/test/unified_malloc_framework/common/provider.hpp index 518b2b0528..1c0388e179 100644 --- a/test/unified_malloc_framework/common/provider.hpp +++ b/test/unified_malloc_framework/common/provider.hpp @@ -30,21 +30,27 @@ struct provider_base { enum umf_result_t alloc(size_t, size_t, void **) noexcept { return UMF_RESULT_ERROR_UNKNOWN; } - enum umf_result_t free(void *ptr, size_t size) noexcept { + enum umf_result_t free([[maybe_unused]] void *ptr, + [[maybe_unused]] size_t size) noexcept { return UMF_RESULT_ERROR_UNKNOWN; } void get_last_native_error(const char **, int32_t *) noexcept {} - enum umf_result_t get_recommended_page_size(size_t size, - size_t *pageSize) noexcept { + enum umf_result_t + get_recommended_page_size([[maybe_unused]] size_t size, + [[maybe_unused]] size_t *pageSize) noexcept { return UMF_RESULT_ERROR_UNKNOWN; } - enum umf_result_t get_min_page_size(void *ptr, size_t *pageSize) noexcept { + enum umf_result_t + get_min_page_size([[maybe_unused]] void *ptr, + [[maybe_unused]] size_t *pageSize) noexcept { return UMF_RESULT_ERROR_UNKNOWN; } - enum umf_result_t purge_lazy(void *ptr, size_t size) noexcept { + enum umf_result_t purge_lazy([[maybe_unused]] void *ptr, + [[maybe_unused]] size_t size) noexcept { return UMF_RESULT_ERROR_UNKNOWN; } - enum umf_result_t purge_force(void *ptr, size_t size) noexcept { + enum umf_result_t purge_force([[maybe_unused]] void *ptr, + [[maybe_unused]] size_t size) noexcept { return UMF_RESULT_ERROR_UNKNOWN; } const char *get_name() noexcept { return "base"; } diff --git a/test/unified_malloc_framework/memoryPoolAPI.cpp b/test/unified_malloc_framework/memoryPoolAPI.cpp index d40254fbf0..7c750583d3 100644 --- a/test/unified_malloc_framework/memoryPoolAPI.cpp +++ b/test/unified_malloc_framework/memoryPoolAPI.cpp @@ -187,9 +187,10 @@ TEST_P(poolInitializeTest, errorPropagation) { umf_memory_provider_handle_t providers[] = {nullProvider.get()}; struct pool : public umf_test::pool_base { - umf_result_t initialize(umf_memory_provider_handle_t *providers, - size_t numProviders, - umf_result_t errorToReturn) noexcept { + umf_result_t + initialize([[maybe_unused]] umf_memory_provider_handle_t *providers, + [[maybe_unused]] size_t numProviders, + umf_result_t errorToReturn) noexcept { return errorToReturn; } }; @@ -233,6 +234,7 @@ TEST_F(test, getLastFailedMemoryProvider) { } enum umf_result_t free(void *ptr, size_t size) noexcept { + (void)size; ::free(ptr); return UMF_RESULT_SUCCESS; } diff --git a/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp b/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp index 9e4d4f7ee6..fd2bfb6106 100644 --- a/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp +++ b/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp @@ -42,7 +42,8 @@ TEST_F(test, freeErrorPropagation) { *ptr = malloc(size); return UMF_RESULT_SUCCESS; } - enum umf_result_t free(void *ptr, size_t size) noexcept { + enum umf_result_t free(void *ptr, + [[maybe_unused]] size_t size) noexcept { ::free(ptr); return freeReturn; } From bd4f75d479d3c98329da5799079b1021b17c89d9 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Fri, 15 Sep 2023 10:21:39 +0100 Subject: [PATCH 030/145] [UR] fix warnings in collector --- examples/collector/collector.cpp | 13 +++++++------ source/common/ur_params.hpp | 27 +++++++++++++-------------- tools/urtrace/collector.cpp | 18 ++++++++++-------- 3 files changed, 30 insertions(+), 28 deletions(-) diff --git a/examples/collector/collector.cpp b/examples/collector/collector.cpp index ba60b083d2..f7118b428b 100644 --- a/examples/collector/collector.cpp +++ b/examples/collector/collector.cpp @@ -82,10 +82,10 @@ static std::unordered_map< * On begin, it prints the function declaration with the call arguments specified, * and on end it prints the function name with the result of the call. */ -XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, - xpti::trace_event_data_t *parent, - xpti::trace_event_data_t *event, - uint64_t instance, const void *user_data) { +XPTI_CALLBACK_API void +trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent, + [[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance, + const void *user_data) { auto *args = static_cast(user_data); std::ostringstream out; if (trace_type == TRACE_FN_BEGIN) { @@ -120,7 +120,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, */ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, unsigned int minor_version, - const char *version_str, + [[maybe_unused]] const char *version_str, const char *stream_name) { if (stream_name == nullptr) { std::cout << "Stream name not provided. Aborting." << std::endl; @@ -158,5 +158,6 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, * * Can be used to cleanup state or resources. */ -XPTI_CALLBACK_API void xptiTraceFinish(const char *stream_name) { /* noop */ +XPTI_CALLBACK_API void +xptiTraceFinish([[maybe_unused]] const char *stream_name) { /* noop */ } diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index d1bda365b2..f2f197ff66 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -454,11 +454,7 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_exp_image_copy_flag_t value); inline std::ostream & operator<<(std::ostream &os, - const struct ur_exp_sampler_mip_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params); -inline std::ostream &operator<<(std::ostream &os, - const struct ur_exp_interop_mem_desc_t params); + [[maybe_unused]] const struct ur_exp_file_descriptor_t params); inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_win32_handle_t params); @@ -466,6 +462,9 @@ inline std::ostream &operator<<( std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); +inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); inline std::ostream &operator<<( @@ -13048,9 +13047,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { os << ".hQueue = "; @@ -13667,10 +13666,9 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct return os; } -inline std::ostream &operator<<( - std::ostream &os, - const struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t - *params) { +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_kernel_suggest_max_cooperative_group_count_exp_params_t *params) { os << ".hKernel = "; @@ -13684,8 +13682,9 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_loader_init_params_t *params) { +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_loader_init_params_t *params) { os << ".device_flags = "; diff --git a/tools/urtrace/collector.cpp b/tools/urtrace/collector.cpp index b502f0d802..e4a0f7c127 100644 --- a/tools/urtrace/collector.cpp +++ b/tools/urtrace/collector.cpp @@ -245,10 +245,12 @@ class JsonWriter : public TraceWriter { "\"tid\": \"\", \"ts\": \"\"}}"); out.info("]\n}}"); } - void begin(uint64_t id, const char *fname, std::string args) override {} + void begin([[maybe_unused]] uint64_t id, [[maybe_unused]] const char *fname, + [[maybe_unused]] std::string args) override {} - void end(uint64_t id, const char *fname, std::string args, Timepoint tp, - Timepoint start_tp, const ur_result_t *resultp) override { + void end([[maybe_unused]] uint64_t id, const char *fname, std::string args, + Timepoint tp, Timepoint start_tp, + [[maybe_unused]] const ur_result_t *resultp) override { auto dur = tp - start_tp; auto ts_us = std::chrono::duration_cast( tp.time_since_epoch()) @@ -314,10 +316,10 @@ std::optional pop_instance_data(uint64_t instance) { return data; } -XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, - xpti::trace_event_data_t *parent, - xpti::trace_event_data_t *event, - uint64_t instance, const void *user_data) { +XPTI_CALLBACK_API void +trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent, + [[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance, + const void *user_data) { // stop the the clock as the very first thing, only used for TRACE_FN_END auto time_for_end = Clock::now(); auto *args = static_cast(user_data); @@ -367,7 +369,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, */ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, unsigned int minor_version, - const char *version_str, + [[maybe_unused]] const char *version_str, const char *stream_name) { if (stream_name == nullptr) { out.debug("Found stream with null name. Skipping..."); From 747613b3251c2eb0d6e4987153f4ffcacaf20b96 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Mon, 18 Sep 2023 16:03:00 +0100 Subject: [PATCH 031/145] [UR] Remove parameters from main --- test/loader/platforms/platforms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/loader/platforms/platforms.cpp b/test/loader/platforms/platforms.cpp index 504cc8404f..8c8f5d7db5 100644 --- a/test/loader/platforms/platforms.cpp +++ b/test/loader/platforms/platforms.cpp @@ -18,7 +18,7 @@ using namespace logger; ////////////////////////////////////////////////////////////////////////// -int main([[maybe_unused]] int argc, [[maybe_unused]] char *argv[]) { +int main(int, char *[]) { logger::init("TEST"); ur_result_t status; From 7217fd7a540d22a6eee153f15bffea2beceea725 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Mon, 18 Sep 2023 17:43:45 +0100 Subject: [PATCH 032/145] [UR] Support Raw C Arrays --- include/ur.py | 4 +-- include/ur_api.h | 10 +++----- scripts/core/exp-bindless-images.yml | 12 +++------ scripts/templates/helper.py | 38 ++++++++++++++++++++++++---- scripts/templates/params.hpp.mako | 9 +++++++ source/common/ur_params.hpp | 21 ++++++--------- test/unit/utils/params.cpp | 27 +++++++++++++++++++- 7 files changed, 84 insertions(+), 37 deletions(-) diff --git a/include/ur.py b/include/ur.py index a1f4f0fd2d..2da7631697 100644 --- a/include/ur.py +++ b/include/ur.py @@ -2228,9 +2228,7 @@ class ur_exp_sampler_addr_modes_t(Structure): ("stype", ur_structure_type_t), ## [in] type of this structure, must be ## ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES ("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure - ("addrModeX", ur_sampler_addressing_mode_t), ## [in] Specify the addressing mode of the x-dimension. - ("addrModeY", ur_sampler_addressing_mode_t), ## [in] Specify the addressing mode of the y-dimension. - ("addrModeZ", ur_sampler_addressing_mode_t) ## [in] Specify the addressing mode of the z-dimension. + ("addrModes", ur_sampler_addressing_mode_t * 3) ## [in] Specify the address mode of the sampler per dimension ] ############################################################################### diff --git a/include/ur_api.h b/include/ur_api.h index e8e770914d..5765df1d86 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -7047,12 +7047,10 @@ typedef struct ur_exp_sampler_mip_properties_t { /// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t /// as part of a `pNext` chain. typedef struct ur_exp_sampler_addr_modes_t { - ur_structure_type_t stype; ///< [in] type of this structure, must be - ///< ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES - void *pNext; ///< [in,out][optional] pointer to extension-specific structure - ur_sampler_addressing_mode_t addrModeX; ///< [in] Specify the addressing mode of the x-dimension. - ur_sampler_addressing_mode_t addrModeY; ///< [in] Specify the addressing mode of the y-dimension. - ur_sampler_addressing_mode_t addrModeZ; ///< [in] Specify the addressing mode of the z-dimension. + ur_structure_type_t stype; ///< [in] type of this structure, must be + ///< ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES + void *pNext; ///< [in,out][optional] pointer to extension-specific structure + ur_sampler_addressing_mode_t addrModes[3]; ///< [in] Specify the address mode of the sampler per dimension } ur_exp_sampler_addr_modes_t; diff --git a/scripts/core/exp-bindless-images.yml b/scripts/core/exp-bindless-images.yml index fe74fb1c5c..b5f87a6633 100644 --- a/scripts/core/exp-bindless-images.yml +++ b/scripts/core/exp-bindless-images.yml @@ -187,15 +187,9 @@ class: $xBindlessImages name: $x_exp_sampler_addr_modes_t base: $x_base_properties_t members: - - type: $x_sampler_addressing_mode_t - name: addrModeX - desc: "[in] Specify the addressing mode of the x-dimension." - - type: $x_sampler_addressing_mode_t - name: addrModeY - desc: "[in] Specify the addressing mode of the y-dimension." - - type: $x_sampler_addressing_mode_t - name: addrModeZ - desc: "[in] Specify the addressing mode of the z-dimension." + - type: $x_sampler_addressing_mode_t[3] + name: addrModes + desc: "[in] Specify the address mode of the sampler per dimension" --- #-------------------------------------------------------------------------- type: struct desc: "Describes an interop memory resource descriptor" diff --git a/scripts/templates/helper.py b/scripts/templates/helper.py index 2b283b8119..15a440da3d 100644 --- a/scripts/templates/helper.py +++ b/scripts/templates/helper.py @@ -105,6 +105,7 @@ class type_traits: RE_DESC = r"(.*)desc_t.*" RE_PROPS = r"(.*)properties_t.*" RE_FLAGS = r"(.*)flags_t" + RE_ARRAY = r"(.*)\[([1-9][0-9]*)\]" @staticmethod def base(name): @@ -217,6 +218,29 @@ def find_class_name(name, meta): except: return None + @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_length(cls, name): + if not cls.is_array(name): + raise Exception("Cannot find array length of non-array type.") + + match = re.match(cls.RE_ARRAY, name) + return match.groups()[1] + + @classmethod + def get_array_element_type(cls, name): + if not cls.is_array(name): + raise Exception("Cannot find array length of non-array type.") + + match = re.match(cls.RE_ARRAY, name) + return match.groups()[0] + """ Extracts traits from a value name """ @@ -729,7 +753,10 @@ def make_etor_lines(namespace, tags, obj, py=False, meta=None): returns c/c++ name of any type """ def _get_type_name(namespace, tags, obj, item): - name = subt(namespace, tags, item['type'],) + type = item['type'] + if type_traits.is_array(type): + type = type_traits.get_array_element_type(type) + name = subt(namespace, tags, type,) return name """ @@ -763,9 +790,9 @@ def get_ctype_name(namespace, tags, item): while type_traits.is_pointer(name): name = "POINTER(%s)"%_remove_ptr(name) - if '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) + if 'name' in item and type_traits.is_array(item['type']): + length = subt(namespace, tags, type_traits.get_array_length(item['type'])) + name = "%s * %s"%(type_traits.get_array_element_type(name), length) return name @@ -804,7 +831,8 @@ def make_member_lines(namespace, tags, obj, prefix="", py=False, meta=None): delim = "," if i < (len(obj['members'])-1) else "" prologue = "(\"%s\", %s)%s"%(name, tname, delim) else: - prologue = "%s %s;"%(tname, name) + array_suffix = f"[{type_traits.get_array_length(item['type'])}]" if type_traits.is_array(item['type']) else "" + prologue = "%s %s %s;"%(tname, name, array_suffix) comment_style = "##" if py else "///<" ws_count = 64 if py else 48 diff --git a/scripts/templates/params.hpp.mako b/scripts/templates/params.hpp.mako index de971c481f..9609a0c211 100644 --- a/scripts/templates/params.hpp.mako +++ b/scripts/templates/params.hpp.mako @@ -84,6 +84,15 @@ def findMemberType(_item): %elif findMemberType(item) is not None and findMemberType(item)['type'] == "union": os << ".${iname} = "; ${x}_params::serializeUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); + %elif th.type_traits.is_array(item['type']): + os << ".${iname} = ["; + for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){ + if(i != 0){ + os << ", "; + } + os << ${deref}(params${access}${item['name']}[i]); + } + os << "]"; %elif typename is not None: os << ".${iname} = "; ${x}_params::serializeTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index b852c72e7c..02a29a1a8f 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -9905,19 +9905,14 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { ur_params::serializeStruct(os, (params.pNext)); os << ", "; - os << ".addrModeX = "; - - os << (params.addrModeX); - - os << ", "; - os << ".addrModeY = "; - - os << (params.addrModeY); - - os << ", "; - os << ".addrModeZ = "; - - os << (params.addrModeZ); + os << ".addrModes = ["; + for (auto i = 0; i < 3; i++) { + if (i != 0) { + os << ", "; + } + os << (params.addrModes[i]); + } + os << "]"; os << "}"; return os; diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index d54263591b..d3a049d5a9 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -367,6 +367,31 @@ struct UrDevicePartitionPropertyTest { ur_device_partition_property_t prop; }; +struct UrSamplerAddressModesTest { + UrSamplerAddressModesTest() { + prop.addrModes[0] = UR_SAMPLER_ADDRESSING_MODE_CLAMP; + prop.addrModes[1] = UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT; + prop.addrModes[2] = UR_SAMPLER_ADDRESSING_MODE_REPEAT; + prop.pNext = nullptr; + prop.stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES; + } + ur_exp_sampler_addr_modes_t &get_struct() { return prop; } + const char *get_expected() { + return "\\(struct ur_exp_sampler_addr_modes_t\\)" + "\\{" + ".stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES, " + ".pNext = nullptr, " + ".addrModes = \\[" + "UR_SAMPLER_ADDRESSING_MODE_CLAMP, " + "UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT, " + "UR_SAMPLER_ADDRESSING_MODE_REPEAT" + "\\]" + "\\}"; + } + + ur_exp_sampler_addr_modes_t prop; +}; + using testing::Types; typedef Types + UrDevicePartitionPropertyTest, UrSamplerAddressModesTest> Implementations; using ::testing::MatchesRegex; From 88c7f8f4e3db8a22880140ea14098c6572c4e2de Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Tue, 19 Sep 2023 09:48:33 +0100 Subject: [PATCH 033/145] [UR] Remove parameter names --- examples/collector/collector.cpp | 13 +++++-------- examples/hello_world/hello_world.cpp | 2 +- source/adapters/null/ur_null.cpp | 8 +++----- .../src/memory_tracker_windows.cpp | 4 +--- source/loader/ur_lib.cpp | 5 ++--- test/conformance/event/urEventSetCallback.cpp | 4 +--- .../unified_malloc_framework/memoryPoolAPI.cpp | 4 ++-- tools/urtrace/collector.cpp | 18 +++++++----------- 8 files changed, 22 insertions(+), 36 deletions(-) diff --git a/examples/collector/collector.cpp b/examples/collector/collector.cpp index f7118b428b..910964e02c 100644 --- a/examples/collector/collector.cpp +++ b/examples/collector/collector.cpp @@ -82,10 +82,9 @@ static std::unordered_map< * On begin, it prints the function declaration with the call arguments specified, * and on end it prints the function name with the result of the call. */ -XPTI_CALLBACK_API void -trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent, - [[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance, - const void *user_data) { +XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, + xpti::trace_event_data_t *, uint64_t instance, + const void *user_data) { auto *args = static_cast(user_data); std::ostringstream out; if (trace_type == TRACE_FN_BEGIN) { @@ -119,8 +118,7 @@ trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent, * selected trace types. */ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, - unsigned int minor_version, - [[maybe_unused]] const char *version_str, + unsigned int minor_version, const char *, const char *stream_name) { if (stream_name == nullptr) { std::cout << "Stream name not provided. Aborting." << std::endl; @@ -158,6 +156,5 @@ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, * * Can be used to cleanup state or resources. */ -XPTI_CALLBACK_API void -xptiTraceFinish([[maybe_unused]] const char *stream_name) { /* noop */ +XPTI_CALLBACK_API void xptiTraceFinish(const char *) { /* noop */ } diff --git a/examples/hello_world/hello_world.cpp b/examples/hello_world/hello_world.cpp index a36b863a3a..904ac6d2ef 100644 --- a/examples/hello_world/hello_world.cpp +++ b/examples/hello_world/hello_world.cpp @@ -15,7 +15,7 @@ #include "ur_api.h" ////////////////////////////////////////////////////////////////////////// -int main([[maybe_unused]] int argc, [[maybe_unused]] char *argv[]) { +int main(int, char *[]) { ur_result_t status; // Initialize the platform diff --git a/source/adapters/null/ur_null.cpp b/source/adapters/null/ur_null.cpp index 7128a452b2..b80fe392ac 100644 --- a/source/adapters/null/ur_null.cpp +++ b/source/adapters/null/ur_null.cpp @@ -39,8 +39,7 @@ context_t::context_t() { }; ////////////////////////////////////////////////////////////////////////// urDdiTable.Platform.pfnGet = - []([[maybe_unused]] ur_adapter_handle_t *phAdapters, - [[maybe_unused]] uint32_t NumAdapters, uint32_t NumEntries, + [](ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, ur_platform_handle_t *phPlatforms, uint32_t *pNumPlatforms) { if (phPlatforms != nullptr && NumEntries != 1) { return UR_RESULT_ERROR_INVALID_SIZE; @@ -122,9 +121,8 @@ context_t::context_t() { ////////////////////////////////////////////////////////////////////////// urDdiTable.Device.pfnGetInfo = - []([[maybe_unused]] ur_device_handle_t hDevice, - ur_device_info_t infoType, size_t propSize, void *pDeviceInfo, - size_t *pPropSizeRet) { + [](ur_device_handle_t, ur_device_info_t infoType, size_t propSize, + void *pDeviceInfo, size_t *pPropSizeRet) { switch (infoType) { case UR_DEVICE_INFO_TYPE: if (pDeviceInfo && propSize != sizeof(ur_device_type_t)) { diff --git a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp index 09c483b7eb..b5545f3490 100644 --- a/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp +++ b/source/common/unified_malloc_framework/src/memory_tracker_windows.cpp @@ -12,11 +12,9 @@ #include "memory_tracker.h" #include - #if defined(UMF_SHARED_LIBRARY) critnib *TRACKER = NULL; -BOOL APIENTRY DllMain([[maybe_unused]] HINSTANCE hinstDLL, DWORD fdwReason, - LPVOID lpvReserved) { +BOOL APIENTRY DllMain(HINSTANCE, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_DETACH) { critnib_delete(TRACKER); } else if (fdwReason == DLL_PROCESS_ATTACH) { diff --git a/source/loader/ur_lib.cpp b/source/loader/ur_lib.cpp index 08dc7e491a..8f704a3322 100644 --- a/source/loader/ur_lib.cpp +++ b/source/loader/ur_lib.cpp @@ -69,9 +69,8 @@ void context_t::tearDownLayers() const { } ////////////////////////////////////////////////////////////////////////// -__urdlllocal ur_result_t -context_t::Init([[maybe_unused]] ur_device_init_flags_t device_flags, - ur_loader_config_handle_t hLoaderConfig) { +__urdlllocal ur_result_t context_t::Init( + ur_device_init_flags_t, ur_loader_config_handle_t hLoaderConfig) { ur_result_t result; const char *logger_name = "loader"; logger::init(logger_name); diff --git a/test/conformance/event/urEventSetCallback.cpp b/test/conformance/event/urEventSetCallback.cpp index ffecacc086..a822b1825b 100644 --- a/test/conformance/event/urEventSetCallback.cpp +++ b/test/conformance/event/urEventSetCallback.cpp @@ -167,9 +167,7 @@ UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEventSetCallbackTest); /* Negative tests */ using urEventSetCallbackNegativeTest = uur::event::urEventTest; -void emptyCallback([[maybe_unused]] ur_event_handle_t hEvent, - [[maybe_unused]] ur_execution_info_t execStatus, - [[maybe_unused]] void *pUserData) {} +void emptyCallback(ur_event_handle_t, ur_execution_info_t, void *) {} TEST_P(urEventSetCallbackNegativeTest, InvalidNullHandleEvent) { ASSERT_EQ_RESULT( diff --git a/test/unified_malloc_framework/memoryPoolAPI.cpp b/test/unified_malloc_framework/memoryPoolAPI.cpp index 7c750583d3..94aaf9541b 100644 --- a/test/unified_malloc_framework/memoryPoolAPI.cpp +++ b/test/unified_malloc_framework/memoryPoolAPI.cpp @@ -233,8 +233,8 @@ TEST_F(test, getLastFailedMemoryProvider) { return allocResult; } - enum umf_result_t free(void *ptr, size_t size) noexcept { - (void)size; + enum umf_result_t free(void *ptr, + [[maybe_unused]] size_t size) noexcept { ::free(ptr); return UMF_RESULT_SUCCESS; } diff --git a/tools/urtrace/collector.cpp b/tools/urtrace/collector.cpp index e4a0f7c127..2d454afc37 100644 --- a/tools/urtrace/collector.cpp +++ b/tools/urtrace/collector.cpp @@ -245,12 +245,10 @@ class JsonWriter : public TraceWriter { "\"tid\": \"\", \"ts\": \"\"}}"); out.info("]\n}}"); } - void begin([[maybe_unused]] uint64_t id, [[maybe_unused]] const char *fname, - [[maybe_unused]] std::string args) override {} + void begin(uint64_t, const char *, std::string) override {} - void end([[maybe_unused]] uint64_t id, const char *fname, std::string args, - Timepoint tp, Timepoint start_tp, - [[maybe_unused]] const ur_result_t *resultp) override { + void end(uint64_t, const char *fname, std::string args, Timepoint tp, + Timepoint start_tp, const ur_result_t *) override { auto dur = tp - start_tp; auto ts_us = std::chrono::duration_cast( tp.time_since_epoch()) @@ -316,10 +314,9 @@ std::optional pop_instance_data(uint64_t instance) { return data; } -XPTI_CALLBACK_API void -trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent, - [[maybe_unused]] xpti::trace_event_data_t *event, uint64_t instance, - const void *user_data) { +XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, + xpti::trace_event_data_t *, uint64_t instance, + const void *user_data) { // stop the the clock as the very first thing, only used for TRACE_FN_END auto time_for_end = Clock::now(); auto *args = static_cast(user_data); @@ -368,8 +365,7 @@ trace_cb(uint16_t trace_type, [[maybe_unused]] xpti::trace_event_data_t *parent, * Called for every stream. */ XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, - unsigned int minor_version, - [[maybe_unused]] const char *version_str, + unsigned int minor_version, const char *, const char *stream_name) { if (stream_name == nullptr) { out.debug("Found stream with null name. Skipping..."); From 28ac2e170bfb02aca56db748aa20037eda356d9d Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 19 Sep 2023 10:56:24 +0100 Subject: [PATCH 034/145] [cmake] Respect Python virtualenv on macOS Fix issue where CMake ignores the Python interpreter specified by a virtual environment by default. This results in the generate targets failing when the Python package requirements are installed in a virtual environment but the system interpreter is found by CMake. This patch replaces the use of `CMAKE_FIND_FRAMEWORK` with the more precise `Python3_FIND_FRAMEWORK`. It also sets the `Python3_FIND_STRATEGY` to `LOCATION` which stops searching once the first Python interpreter is found, i.e. the interpreter from an activated virtual environment, or the system interpreter otherwise. --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05243d5102..bac1908992 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") include(helpers) if(CMAKE_SYSTEM_NAME STREQUAL Darwin) - set(CMAKE_FIND_FRAMEWORK NEVER) + set(Python3_FIND_FRAMEWORK NEVER) + set(Python3_FIND_STRATEGY LOCATION) endif() find_package(Python3 COMPONENTS Interpreter REQUIRED) From e9aa0f4e1108a8ff4ce0d5ed65510ad9954622a1 Mon Sep 17 00:00:00 2001 From: Petr Vesely Date: Tue, 19 Sep 2023 11:38:29 +0100 Subject: [PATCH 035/145] [UR] Address Review Feedback --- scripts/templates/helper.py | 2 +- scripts/templates/params.hpp.mako | 8 +++++--- source/common/ur_params.hpp | 5 +++-- test/unit/utils/params.cpp | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/templates/helper.py b/scripts/templates/helper.py index 15a440da3d..e6e3a8569e 100644 --- a/scripts/templates/helper.py +++ b/scripts/templates/helper.py @@ -236,7 +236,7 @@ def get_array_length(cls, name): @classmethod def get_array_element_type(cls, name): if not cls.is_array(name): - raise Exception("Cannot find array length of non-array type.") + raise Exception("Cannot find array type of non-array type.") match = re.match(cls.RE_ARRAY, name) return match.groups()[0] diff --git a/scripts/templates/params.hpp.mako b/scripts/templates/params.hpp.mako index 9609a0c211..30d39a9e9a 100644 --- a/scripts/templates/params.hpp.mako +++ b/scripts/templates/params.hpp.mako @@ -85,14 +85,16 @@ def findMemberType(_item): os << ".${iname} = "; ${x}_params::serializeUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); %elif th.type_traits.is_array(item['type']): - os << ".${iname} = ["; + os << ".${iname} = {"; for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){ if(i != 0){ os << ", "; } - os << ${deref}(params${access}${item['name']}[i]); + <%call expr="member(iname, itype, True)"> + ${deref}(params${access}${item['name']}[i]) + } - os << "]"; + os << "}"; %elif typename is not None: os << ".${iname} = "; ${x}_params::serializeTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 02a29a1a8f..b2d78ee0b6 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -9905,14 +9905,15 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { ur_params::serializeStruct(os, (params.pNext)); os << ", "; - os << ".addrModes = ["; + os << ".addrModes = {"; for (auto i = 0; i < 3; i++) { if (i != 0) { os << ", "; } + os << (params.addrModes[i]); } - os << "]"; + os << "}"; os << "}"; return os; diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index d3a049d5a9..d6310f8bbd 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -381,11 +381,11 @@ struct UrSamplerAddressModesTest { "\\{" ".stype = UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES, " ".pNext = nullptr, " - ".addrModes = \\[" + ".addrModes = \\{" "UR_SAMPLER_ADDRESSING_MODE_CLAMP, " "UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT, " "UR_SAMPLER_ADDRESSING_MODE_REPEAT" - "\\]" + "\\}" "\\}"; } From d47bd7e6d17c1c19b07700ed533c7c010d84b418 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Tue, 19 Sep 2023 15:40:07 +0100 Subject: [PATCH 036/145] Fix a few small spec issues: * Clarify INVALID_SIZE return for PlatformGet * Add PROFILING_INFO_NOT_AVAILABLE to GetProfilingInfo returns * Make WriteHostPipe's phEvent param optional (matches other phEvent params) --- include/ur_api.h | 6 ++++-- scripts/core/enqueue.yml | 2 +- scripts/core/event.yml | 2 ++ scripts/core/platform.yml | 3 ++- source/adapters/null/ur_nullddi.cpp | 6 ++++-- source/loader/layers/tracing/ur_trcddi.cpp | 2 +- source/loader/layers/validation/ur_valddi.cpp | 10 +++++----- source/loader/ur_ldrddi.cpp | 8 +++++--- source/loader/ur_libapi.cpp | 6 ++++-- source/ur_api.cpp | 6 ++++-- 10 files changed, 32 insertions(+), 19 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 5765df1d86..233fbc51f7 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -946,6 +946,7 @@ typedef enum ur_adapter_backend_t { /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phAdapters` /// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phPlatforms != NULL` UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet( ur_adapter_handle_t *phAdapters, ///< [in][range(0, NumAdapters)] array of adapters to query for platforms. @@ -5521,6 +5522,8 @@ urEventGetInfo( /// + `NULL == hEvent` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_PROFILING_INFO_COMMAND_COMPLETE < propName` +/// - ::UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE +/// + If `hEvent`s associated queue was not created with `UR_QUEUE_FLAG_PROFILING_ENABLE`. /// - ::UR_RESULT_ERROR_INVALID_VALUE /// + `pPropValue && propSize == 0` /// - ::UR_RESULT_ERROR_INVALID_EVENT @@ -6937,7 +6940,6 @@ urEnqueueReadHostPipe( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pipe_symbol` /// + `NULL == pSrc` -/// + `NULL == phEvent` /// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST /// + `phEventWaitList == NULL && numEventsInWaitList > 0` /// + `phEventWaitList != NULL && numEventsInWaitList == 0` @@ -6958,7 +6960,7 @@ urEnqueueWriteHostPipe( const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. - ur_event_handle_t *phEvent ///< [out] returns an event object that identifies this write command + ur_event_handle_t *phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ); diff --git a/scripts/core/enqueue.yml b/scripts/core/enqueue.yml index 8d3347dfbe..7da1c8f680 100644 --- a/scripts/core/enqueue.yml +++ b/scripts/core/enqueue.yml @@ -1458,7 +1458,7 @@ params: - type: $x_event_handle_t* name: phEvent desc: | - [out] returns an event object that identifies this write command + [out][optional] returns an event object that identifies this write command and can be used to query or queue a wait for this command to complete. returns: - $X_RESULT_ERROR_INVALID_EVENT_WAIT_LIST: diff --git a/scripts/core/event.yml b/scripts/core/event.yml index c20a8e04c9..e34138d663 100644 --- a/scripts/core/event.yml +++ b/scripts/core/event.yml @@ -185,6 +185,8 @@ params: name: pPropSizeRet desc: "[out][optional] pointer to the actual size in bytes returned in propValue" returns: + - $X_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE: + - "If `hEvent`s associated queue was not created with `UR_QUEUE_FLAG_PROFILING_ENABLE`." - $X_RESULT_ERROR_INVALID_VALUE: - "`pPropValue && propSize == 0`" - $X_RESULT_ERROR_INVALID_EVENT diff --git a/scripts/core/platform.yml b/scripts/core/platform.yml index dbbbe312a9..f583f7d007 100644 --- a/scripts/core/platform.yml +++ b/scripts/core/platform.yml @@ -46,7 +46,8 @@ params: desc: | [out][optional] returns the total number of platforms available. returns: - - $X_RESULT_ERROR_INVALID_SIZE + - $X_RESULT_ERROR_INVALID_SIZE: + - "`NumEntries == 0 && phPlatforms != NULL`" --- #-------------------------------------------------------------------------- type: enum desc: "Supported platform info" diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 314cb9138e..ed0f00de41 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -3832,7 +3832,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. ur_event_handle_t * - phEvent ///< [out] returns an event object that identifies this write command + phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ) try { ur_result_t result = UR_RESULT_SUCCESS; @@ -3845,7 +3845,9 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( phEvent); } else { // generic implementation - *phEvent = reinterpret_cast(d_context.get()); + if (nullptr != phEvent) { + *phEvent = reinterpret_cast(d_context.get()); + } } return result; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 6e4ce75bb8..a79ef3cd10 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -4338,7 +4338,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. ur_event_handle_t * - phEvent ///< [out] returns an event object that identifies this write command + phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ) { auto pfnWriteHostPipe = context.urDdiTable.Enqueue.pfnWriteHostPipe; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index afbabc817a..aa708197b6 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -214,6 +214,10 @@ __urdlllocal ur_result_t UR_APICALL urPlatformGet( if (NULL == phAdapters) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } + + if (NumEntries == 0 && phPlatforms != NULL) { + return UR_RESULT_ERROR_INVALID_SIZE; + } } ur_result_t result = @@ -5520,7 +5524,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. ur_event_handle_t * - phEvent ///< [out] returns an event object that identifies this write command + phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ) { auto pfnWriteHostPipe = context.urDdiTable.Enqueue.pfnWriteHostPipe; @@ -5546,10 +5550,6 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (NULL == phEvent) { - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - } - if (phEventWaitList == NULL && numEventsInWaitList > 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 528b2d1eba..06923cc062 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -5271,7 +5271,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. ur_event_handle_t * - phEvent ///< [out] returns an event object that identifies this write command + phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ) { ur_result_t result = UR_RESULT_SUCCESS; @@ -5308,8 +5308,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( try { // convert platform handle to loader handle - *phEvent = reinterpret_cast( - ur_event_factory.getInstance(*phEvent, dditable)); + if (nullptr != phEvent) { + *phEvent = reinterpret_cast( + ur_event_factory.getInstance(*phEvent, dditable)); + } } catch (std::bad_alloc &) { result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 403ee6f6f9..ee9135dd59 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -453,6 +453,7 @@ ur_result_t UR_APICALL urAdapterGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phAdapters` /// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phPlatforms != NULL` ur_result_t UR_APICALL urPlatformGet( ur_adapter_handle_t * phAdapters, ///< [in][range(0, NumAdapters)] array of adapters to query for platforms. @@ -4332,6 +4333,8 @@ ur_result_t UR_APICALL urEventGetInfo( /// + `NULL == hEvent` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_PROFILING_INFO_COMMAND_COMPLETE < propName` +/// - ::UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE +/// + If `hEvent`s associated queue was not created with `UR_QUEUE_FLAG_PROFILING_ENABLE`. /// - ::UR_RESULT_ERROR_INVALID_VALUE /// + `pPropValue && propSize == 0` /// - ::UR_RESULT_ERROR_INVALID_EVENT @@ -6089,7 +6092,6 @@ ur_result_t UR_APICALL urEnqueueReadHostPipe( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pipe_symbol` /// + `NULL == pSrc` -/// + `NULL == phEvent` /// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST /// + `phEventWaitList == NULL && numEventsInWaitList > 0` /// + `phEventWaitList != NULL && numEventsInWaitList == 0` @@ -6116,7 +6118,7 @@ ur_result_t UR_APICALL urEnqueueWriteHostPipe( ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. ur_event_handle_t * - phEvent ///< [out] returns an event object that identifies this write command + phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ) try { auto pfnWriteHostPipe = diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 1bf371d7d9..7ecf3596db 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -398,6 +398,7 @@ ur_result_t UR_APICALL urAdapterGetInfo( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == phAdapters` /// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `NumEntries == 0 && phPlatforms != NULL` ur_result_t UR_APICALL urPlatformGet( ur_adapter_handle_t * phAdapters, ///< [in][range(0, NumAdapters)] array of adapters to query for platforms. @@ -3664,6 +3665,8 @@ ur_result_t UR_APICALL urEventGetInfo( /// + `NULL == hEvent` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// + `::UR_PROFILING_INFO_COMMAND_COMPLETE < propName` +/// - ::UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE +/// + If `hEvent`s associated queue was not created with `UR_QUEUE_FLAG_PROFILING_ENABLE`. /// - ::UR_RESULT_ERROR_INVALID_VALUE /// + `pPropValue && propSize == 0` /// - ::UR_RESULT_ERROR_INVALID_EVENT @@ -5181,7 +5184,6 @@ ur_result_t UR_APICALL urEnqueueReadHostPipe( /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pipe_symbol` /// + `NULL == pSrc` -/// + `NULL == phEvent` /// - ::UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST /// + `phEventWaitList == NULL && numEventsInWaitList > 0` /// + `phEventWaitList != NULL && numEventsInWaitList == 0` @@ -5208,7 +5210,7 @@ ur_result_t UR_APICALL urEnqueueWriteHostPipe( ///< events that must be complete before the host pipe write. ///< If nullptr, the numEventsInWaitList must be 0, indicating that no wait event. ur_event_handle_t * - phEvent ///< [out] returns an event object that identifies this write command + phEvent ///< [out][optional] returns an event object that identifies this write command ///< and can be used to query or queue a wait for this command to complete. ) { ur_result_t result = UR_RESULT_SUCCESS; From db4200343f367d7a993516afbb3e319ca8c4dc04 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Wed, 20 Sep 2023 10:56:03 +0100 Subject: [PATCH 037/145] Fix a few minor CTS issues, notably: * Remove null pointer tests for optional EnqueueWriteHostPipe and KernelCreateWithNativeHandle params * Correct a few error code expectations * Ensure virtual mem tests skip properly when there isn't support --- .../enqueue/urEnqueueMemImageCopy.cpp | 2 +- .../enqueue/urEnqueueWriteHostPipe.cpp | 12 -------- .../kernel/urKernelCreateWithNativeHandle.cpp | 9 +----- .../kernel/urKernelSetArgPointer.cpp | 2 +- .../urProgramCreateWithNativeHandle.cpp | 4 +-- test/conformance/program/urProgramGetInfo.cpp | 9 +++++- .../testing/include/uur/fixtures.h | 14 ++++++--- .../urVirtualMemGranularityGetInfo.cpp | 30 +++++++++++++++++-- 8 files changed, 50 insertions(+), 32 deletions(-) diff --git a/test/conformance/enqueue/urEnqueueMemImageCopy.cpp b/test/conformance/enqueue/urEnqueueMemImageCopy.cpp index d3cb5b566e..e75ab38976 100644 --- a/test/conformance/enqueue/urEnqueueMemImageCopy.cpp +++ b/test/conformance/enqueue/urEnqueueMemImageCopy.cpp @@ -62,7 +62,7 @@ struct urEnqueueMemImageCopyTest void TearDown() override { if (srcImage) { - EXPECT_SUCCESS(urMemRelease(dstImage)); + EXPECT_SUCCESS(urMemRelease(srcImage)); } if (dstImage) { EXPECT_SUCCESS(urMemRelease(dstImage)); diff --git a/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp b/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp index 20ef1da38b..917a94a672 100644 --- a/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp +++ b/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp @@ -55,18 +55,6 @@ TEST_P(urEnqueueWriteHostPipeTest, InvalidNullPointerBuffer) { &phEventWaitList, phEvent)); } -TEST_P(urEnqueueWriteHostPipeTest, InvalidNullPointerEvent) { - uint32_t numEventsInWaitList = 0; - ur_event_handle_t phEventWaitList; - ur_event_handle_t *phEvent = nullptr; - - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER, - urEnqueueWriteHostPipe(queue, program, pipe_symbol, - /*blocking*/ true, &buffer, size, - numEventsInWaitList, - &phEventWaitList, phEvent)); -} - TEST_P(urEnqueueWriteHostPipeTest, InvalidEventWaitList) { ur_event_handle_t phEventWaitList; ur_event_handle_t *phEvent = nullptr; diff --git a/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp b/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp index 7575fb309f..83dd83f679 100644 --- a/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp +++ b/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp @@ -56,15 +56,8 @@ TEST_P(urKernelCreateWithNativeHandleTest, InvalidNullHandleProgram) { &properties, &native_kernel)); } -TEST_P(urKernelCreateWithNativeHandleTest, InvalidNullPointerProperties) { - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, - urKernelCreateWithNativeHandle(native_kernel_handle, - context, program, nullptr, - &native_kernel)); -} - TEST_P(urKernelCreateWithNativeHandleTest, InvalidNullPointerNativeKernel) { - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER, urKernelCreateWithNativeHandle(native_kernel_handle, context, program, &properties, nullptr)); diff --git a/test/conformance/kernel/urKernelSetArgPointer.cpp b/test/conformance/kernel/urKernelSetArgPointer.cpp index 4cb4cb2c8f..50396eb2ed 100644 --- a/test/conformance/kernel/urKernelSetArgPointer.cpp +++ b/test/conformance/kernel/urKernelSetArgPointer.cpp @@ -129,9 +129,9 @@ struct urKernelSetArgPointerNegativeTest : urKernelSetArgPointerTest { } void SetUp() { + UUR_RETURN_ON_FATAL_FAILURE(urKernelSetArgPointerTest::SetUp()); SetUpAllocation(); ASSERT_NE(allocation, nullptr); - UUR_RETURN_ON_FATAL_FAILURE(urKernelSetArgPointerTest::SetUp()); } }; UUR_INSTANTIATE_KERNEL_TEST_SUITE_P(urKernelSetArgPointerNegativeTest); diff --git a/test/conformance/program/urProgramCreateWithNativeHandle.cpp b/test/conformance/program/urProgramCreateWithNativeHandle.cpp index 7e0400d294..e121c61de8 100644 --- a/test/conformance/program/urProgramCreateWithNativeHandle.cpp +++ b/test/conformance/program/urProgramCreateWithNativeHandle.cpp @@ -41,12 +41,12 @@ TEST_P(urProgramCreateWithNativeHandleTest, Success) { TEST_P(urProgramCreateWithNativeHandleTest, InvalidNullHandleContext) { ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, urProgramCreateWithNativeHandle(native_program_handle, - context, nullptr, + nullptr, nullptr, &native_program)); } TEST_P(urProgramCreateWithNativeHandleTest, InvalidNullPointerProgram) { - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_HANDLE, + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_NULL_POINTER, urProgramCreateWithNativeHandle( native_program_handle, context, nullptr, nullptr)); } diff --git a/test/conformance/program/urProgramGetInfo.cpp b/test/conformance/program/urProgramGetInfo.cpp index ebe840bee0..80d00072e7 100644 --- a/test/conformance/program/urProgramGetInfo.cpp +++ b/test/conformance/program/urProgramGetInfo.cpp @@ -5,7 +5,14 @@ #include -using urProgramGetInfoTest = uur::urProgramTestWithParam; +struct urProgramGetInfoTest : uur::urProgramTestWithParam { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE( + urProgramTestWithParam::SetUp()); + // Some queries need the program to be built. + ASSERT_SUCCESS(urProgramBuild(this->context, program, nullptr)); + } +}; UUR_TEST_SUITE_P( urProgramGetInfoTest, diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index fbb8a48fb1..3ae09924b0 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -810,7 +810,9 @@ struct urVirtualMemMappedTest : urVirtualMemTest { } void TearDown() override { - EXPECT_SUCCESS(urVirtualMemUnmap(context, virtual_ptr, size)); + if (virtual_ptr) { + EXPECT_SUCCESS(urVirtualMemUnmap(context, virtual_ptr, size)); + } UUR_RETURN_ON_FATAL_FAILURE(urVirtualMemTest::TearDown()); } }; @@ -826,8 +828,10 @@ struct urVirtualMemMappedTestWithParam : urVirtualMemTestWithParam { } void TearDown() override { - EXPECT_SUCCESS( - urVirtualMemUnmap(this->context, this->virtual_ptr, this->size)); + if (this->virtual_ptr) { + EXPECT_SUCCESS(urVirtualMemUnmap(this->context, this->virtual_ptr, + this->size)); + } UUR_RETURN_ON_FATAL_FAILURE(urVirtualMemTestWithParam::TearDown()); } }; @@ -861,7 +865,9 @@ struct urUSMDeviceAllocTestWithParam : urQueueTestWithParam { } void TearDown() override { - ASSERT_SUCCESS(urUSMFree(this->context, ptr)); + if (ptr) { + ASSERT_SUCCESS(urUSMFree(this->context, ptr)); + } if (pool) { ASSERT_TRUE(use_pool); ASSERT_SUCCESS(urUSMPoolRelease(pool)); diff --git a/test/conformance/virtual_memory/urVirtualMemGranularityGetInfo.cpp b/test/conformance/virtual_memory/urVirtualMemGranularityGetInfo.cpp index d4feccd6dc..c3331f1b5b 100644 --- a/test/conformance/virtual_memory/urVirtualMemGranularityGetInfo.cpp +++ b/test/conformance/virtual_memory/urVirtualMemGranularityGetInfo.cpp @@ -4,8 +4,20 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include -using urVirtualMemGranularityGetInfoTest = - uur::urContextTestWithParam; +struct urVirtualMemGranularityGetInfoTest + : uur::urContextTestWithParam { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE( + urContextTestWithParam::SetUp()); + ur_bool_t virtual_memory_support = false; + ASSERT_SUCCESS(urDeviceGetInfo( + this->device, UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT, + sizeof(ur_bool_t), &virtual_memory_support, nullptr)); + if (!virtual_memory_support) { + GTEST_SKIP() << "Virtual memory is not supported."; + } + } +}; UUR_TEST_SUITE_P( urVirtualMemGranularityGetInfoTest, @@ -42,7 +54,19 @@ TEST_P(urVirtualMemGranularityGetInfoTest, Success) { } } -using urVirtualMemGranularityGetInfoNegativeTest = uur::urContextTest; +struct urVirtualMemGranularityGetInfoNegativeTest : uur::urContextTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urContextTest::SetUp()); + + ur_bool_t virtual_memory_support = false; + ASSERT_SUCCESS(urDeviceGetInfo( + device, UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT, sizeof(ur_bool_t), + &virtual_memory_support, nullptr)); + if (!virtual_memory_support) { + GTEST_SKIP() << "Virtual memory is not supported."; + } + } +}; UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urVirtualMemGranularityGetInfoNegativeTest); TEST_P(urVirtualMemGranularityGetInfoNegativeTest, InvalidNullHandleContext) { From 1cccb506c10cecb486b514ede42e8a85553df923 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Fri, 22 Sep 2023 17:22:39 +0100 Subject: [PATCH 038/145] [EXP][CMDBUF] Add Prefetch and Advise commands to cmd buffer experimental feature Adds USM Prefetch and Advise append commands Update feature spec for new commands --- include/ur.py | 20 ++++ include/ur_api.h | 95 ++++++++++++++++ include/ur_ddi.h | 22 ++++ scripts/core/EXP-COMMAND-BUFFER.rst | 9 ++ scripts/core/exp-command-buffer.yml | 69 ++++++++++++ scripts/core/registry.yml | 6 + source/adapters/null/ur_nullddi.cpp | 67 +++++++++++ source/common/ur_params.hpp | 88 +++++++++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 87 +++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 105 ++++++++++++++++++ source/loader/ur_ldrddi.cpp | 79 +++++++++++++ source/loader/ur_libapi.cpp | 94 ++++++++++++++++ source/ur_api.cpp | 77 +++++++++++++ 13 files changed, 818 insertions(+) diff --git a/include/ur.py b/include/ur.py index 2da7631697..95582d636c 100644 --- a/include/ur.py +++ b/include/ur.py @@ -200,6 +200,8 @@ class ur_function_v(IntEnum): COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192 ## Enumerator for ::urCommandBufferAppendMemBufferFillExp ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193 ## Enumerator for ::urEnqueueCooperativeKernelLaunchExp KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp + COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195 ## Enumerator for ::urCommandBufferAppendUSMPrefetchExp + COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196 ## Enumerator for ::urCommandBufferAppendUSMAdviseExp class ur_function_t(c_int): def __str__(self): @@ -3616,6 +3618,20 @@ class ur_usm_exp_dditable_t(Structure): else: _urCommandBufferAppendMemBufferFillExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, ur_mem_handle_t, c_void_p, c_size_t, c_size_t, c_size_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +############################################################################### +## @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp +if __use_win_types: + _urCommandBufferAppendUSMPrefetchExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_migration_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendUSMPrefetchExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_migration_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) + +############################################################################### +## @brief Function-pointer for urCommandBufferAppendUSMAdviseExp +if __use_win_types: + _urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) +else: + _urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) + ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp if __use_win_types: @@ -3642,6 +3658,8 @@ class ur_command_buffer_exp_dditable_t(Structure): ("pfnAppendMemBufferWriteRectExp", c_void_p), ## _urCommandBufferAppendMemBufferWriteRectExp_t ("pfnAppendMemBufferReadRectExp", c_void_p), ## _urCommandBufferAppendMemBufferReadRectExp_t ("pfnAppendMemBufferFillExp", c_void_p), ## _urCommandBufferAppendMemBufferFillExp_t + ("pfnAppendUSMPrefetchExp", c_void_p), ## _urCommandBufferAppendUSMPrefetchExp_t + ("pfnAppendUSMAdviseExp", c_void_p), ## _urCommandBufferAppendUSMAdviseExp_t ("pfnEnqueueExp", c_void_p) ## _urCommandBufferEnqueueExp_t ] @@ -4162,6 +4180,8 @@ def __init__(self, version : ur_api_version_t): self.urCommandBufferAppendMemBufferWriteRectExp = _urCommandBufferAppendMemBufferWriteRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferWriteRectExp) self.urCommandBufferAppendMemBufferReadRectExp = _urCommandBufferAppendMemBufferReadRectExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferReadRectExp) self.urCommandBufferAppendMemBufferFillExp = _urCommandBufferAppendMemBufferFillExp_t(self.__dditable.CommandBufferExp.pfnAppendMemBufferFillExp) + self.urCommandBufferAppendUSMPrefetchExp = _urCommandBufferAppendUSMPrefetchExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMPrefetchExp) + self.urCommandBufferAppendUSMAdviseExp = _urCommandBufferAppendUSMAdviseExp_t(self.__dditable.CommandBufferExp.pfnAppendUSMAdviseExp) self.urCommandBufferEnqueueExp = _urCommandBufferEnqueueExp_t(self.__dditable.CommandBufferExp.pfnEnqueueExp) # call driver to get function pointers diff --git a/include/ur_api.h b/include/ur_api.h index 233fbc51f7..d9a65f4683 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -209,6 +209,8 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP = 192, ///< Enumerator for ::urCommandBufferAppendMemBufferFillExp UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP = 193, ///< Enumerator for ::urEnqueueCooperativeKernelLaunchExp UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp + UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -8159,6 +8161,73 @@ urCommandBufferAppendMemBufferFillExp( ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// @@ -10332,6 +10401,32 @@ typedef struct ur_command_buffer_append_mem_buffer_fill_exp_params_t { ur_exp_command_buffer_sync_point_t **ppSyncPoint; } ur_command_buffer_append_mem_buffer_fill_exp_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMPrefetchExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_prefetch_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + size_t *psize; + ur_usm_migration_flags_t *pflags; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_usm_prefetch_exp_params_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urCommandBufferAppendUSMAdviseExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_command_buffer_append_usm_advise_exp_params_t { + ur_exp_command_buffer_handle_t *phCommandBuffer; + void **ppMemory; + size_t *psize; + ur_usm_advice_flags_t *padvice; + ur_exp_command_buffer_sync_point_t **ppSyncPoint; +} ur_command_buffer_append_usm_advise_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urCommandBufferEnqueueExp /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index ae5edf6371..bd8878aab9 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1923,6 +1923,26 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( + ur_exp_command_buffer_handle_t, + void *, + size_t, + ur_usm_migration_flags_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, + ur_exp_command_buffer_sync_point_t *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp +typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( + ur_exp_command_buffer_handle_t, + void *, + size_t, + ur_usm_advice_flags_t, + ur_exp_command_buffer_sync_point_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urCommandBufferEnqueueExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferEnqueueExp_t)( @@ -1949,6 +1969,8 @@ typedef struct ur_command_buffer_exp_dditable_t { ur_pfnCommandBufferAppendMemBufferWriteRectExp_t pfnAppendMemBufferWriteRectExp; ur_pfnCommandBufferAppendMemBufferReadRectExp_t pfnAppendMemBufferReadRectExp; ur_pfnCommandBufferAppendMemBufferFillExp_t pfnAppendMemBufferFillExp; + ur_pfnCommandBufferAppendUSMPrefetchExp_t pfnAppendUSMPrefetchExp; + ur_pfnCommandBufferAppendUSMAdviseExp_t pfnAppendUSMAdviseExp; ur_pfnCommandBufferEnqueueExp_t pfnEnqueueExp; } ur_command_buffer_exp_dditable_t; diff --git a/scripts/core/EXP-COMMAND-BUFFER.rst b/scripts/core/EXP-COMMAND-BUFFER.rst index 9617044432..d7c7f6cd13 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -101,6 +101,8 @@ Currently only the following commands are supported: * ${x}CommandBufferAppendMemBufferWriteExp * ${x}CommandBufferAppendMemBufferWriteRectExp * ${x}CommandBufferAppendMemBufferFillExp +* ${x}CommandBufferAppendUSMPrefetchExp +* ${x}CommandBufferAppendUSMAdviseExp It is planned to eventually support any command type from the Core API which can actually be appended to the equiavalent adapter native constructs. @@ -178,6 +180,8 @@ Enums * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP + * ${X}_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP @@ -204,6 +208,8 @@ Functions * ${x}CommandBufferAppendMemBufferWriteExp * ${x}CommandBufferAppendMemBufferWriteRectExp * ${x}CommandBufferAppendMemBufferFillExp +* ${x}CommandBufferAppendUSMPrefetchExp +* ${x}CommandBufferAppendUSMAdviseExp * ${x}CommandBufferEnqueueExp Changelog @@ -218,6 +224,9 @@ Changelog +-----------+-------------------------------------------------------+ | 1.2 | Add function definitions for fill commands | +-----------+-------------------------------------------------------+ +| 1.2 | Add function definitions for Prefetch and Advise | +| | commands | ++-----------+-------------------------------------------------------+ Contributors -------------------------------------------------------------------------------- diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 691bf56b86..553adcd9ce 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -588,6 +588,75 @@ returns: - $X_RESULT_ERROR_OUT_OF_RESOURCES --- #-------------------------------------------------------------------------- type: function +desc: "Append a USM Prefetch command to a command-buffer object" +class: $xCommandBuffer +name: AppendUSMPrefetchExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: "void*" + name: pMemory + desc: "[in] pointer to USM allocated memory to prefetch." + - type: "size_t" + name: size + desc: "[in] size in bytes to be fetched." + - type: $x_usm_migration_flags_t + name: flags + desc: "[in] USM prefetch flags" + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." + - type: "$x_exp_command_buffer_sync_point_t*" + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`size == 0`" + - "If `size` is higher than the allocation size of `pMemory`" + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function +desc: "Append a USM Advise command to a command-buffer object" +class: $xCommandBuffer +name: AppendUSMAdviseExp +params: + - type: $x_exp_command_buffer_handle_t + name: hCommandBuffer + desc: "[in] handle of the command-buffer object." + - type: "void*" + name: pMemory + desc: "[in] pointer to the USM memory object." + - type: "size_t" + name: size + desc: "[in] size in bytes to be advised." + - type: $x_usm_advice_flags_t + name: advice + desc: "[in] USM memory advice" + - type: "$x_exp_command_buffer_sync_point_t*" + name: pSyncPoint + desc: "[out][optional] sync point associated with this command." +returns: + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_MEM_OBJECT + - $X_RESULT_ERROR_INVALID_SIZE: + - "`size == 0`" + - "If `size` is higher than the allocation size of `pMemory`" + - $X_RESULT_ERROR_OUT_OF_HOST_MEMORY + - $X_RESULT_ERROR_OUT_OF_RESOURCES +--- #-------------------------------------------------------------------------- +type: function desc: "Submit a command-buffer for execution on a queue." class: $xCommandBuffer name: EnqueueExp diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 4924e3e947..7952b145f5 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -541,6 +541,12 @@ etors: - name: KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP desc: Enumerator for $xKernelSuggestMaxCooperativeGroupCountExp value: '194' +- name: COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP + desc: Enumerator for $xCommandBufferAppendUSMPrefetchExp + value: '195' +- name: COMMAND_BUFFER_APPEND_USM_ADVISE_EXP + desc: Enumerator for $xCommandBufferAppendUSMAdviseExp + value: '196' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index ed0f00de41..8f668fa12c 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4893,6 +4893,67 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendUSMPrefetchExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + if (nullptr != pfnAppendUSMPrefetchExp) { + result = pfnAppendUSMPrefetchExp(hCommandBuffer, pMemory, size, flags, + numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnAppendUSMAdviseExp = + d_context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + if (nullptr != pfnAppendUSMAdviseExp) { + result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + pSyncPoint); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -5302,6 +5363,12 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = driver::urCommandBufferAppendMemBufferFillExp; + pDdiTable->pfnAppendUSMPrefetchExp = + driver::urCommandBufferAppendUSMPrefetchExp; + + pDdiTable->pfnAppendUSMAdviseExp = + driver::urCommandBufferAppendUSMAdviseExp; + pDdiTable->pfnEnqueueExp = driver::urCommandBufferEnqueueExp; return result; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 06c14ac835..8bf5293f61 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -1194,6 +1194,14 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: os << "UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP"; break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP"; + break; + + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: + os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP"; + break; default: os << "unknown enumerator"; break; @@ -11352,6 +11360,78 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct return os; } +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_prefetch_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur_params::serializePtr(os, *(params->ppMemory)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".flags = "; + + ur_params::serializeFlag(os, *(params->pflags)); + + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + + os << ", "; + os << ".pSyncPoint = "; + + ur_params::serializePtr(os, *(params->ppSyncPoint)); + + return os; +} + +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_command_buffer_append_usm_advise_exp_params_t *params) { + + os << ".hCommandBuffer = "; + + ur_params::serializePtr(os, *(params->phCommandBuffer)); + + os << ", "; + os << ".pMemory = "; + + ur_params::serializePtr(os, *(params->ppMemory)); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".advice = "; + + ur_params::serializeFlag(os, *(params->padvice)); + + os << ", "; + os << ".pSyncPoint = "; + + ur_params::serializePtr(os, *(params->ppSyncPoint)); + + return os; +} + inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t @@ -15843,6 +15923,14 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t *)params; } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: { + os << (const struct ur_command_buffer_append_usm_prefetch_exp_params_t + *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: { + os << (const struct ur_command_buffer_append_usm_advise_exp_params_t *) + params; + } break; case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: { os << (const struct ur_command_buffer_enqueue_exp_params_t *)params; } break; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index a79ef3cd10..c3c8a638d9 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5656,6 +5656,85 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMPrefetchExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_usm_prefetch_exp_params_t params = { + &hCommandBuffer, + &pMemory, + &size, + &flags, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, + "urCommandBufferAppendUSMPrefetchExp", ¶ms); + + ur_result_t result = pfnAppendUSMPrefetchExp( + hCommandBuffer, pMemory, size, flags, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP, + "urCommandBufferAppendUSMPrefetchExp", ¶ms, &result, + instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMAdviseExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_command_buffer_append_usm_advise_exp_params_t params = { + &hCommandBuffer, &pMemory, &size, &advice, &pSyncPoint}; + uint64_t instance = + context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, + "urCommandBufferAppendUSMAdviseExp", ¶ms); + + ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, + advice, pSyncPoint); + + context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, + "urCommandBufferAppendUSMAdviseExp", ¶ms, &result, + instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -6168,6 +6247,14 @@ __urdlllocal ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = ur_tracing_layer::urCommandBufferAppendMemBufferFillExp; + dditable.pfnAppendUSMPrefetchExp = pDdiTable->pfnAppendUSMPrefetchExp; + pDdiTable->pfnAppendUSMPrefetchExp = + ur_tracing_layer::urCommandBufferAppendUSMPrefetchExp; + + dditable.pfnAppendUSMAdviseExp = pDdiTable->pfnAppendUSMAdviseExp; + pDdiTable->pfnAppendUSMAdviseExp = + ur_tracing_layer::urCommandBufferAppendUSMAdviseExp; + dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_tracing_layer::urCommandBufferEnqueueExp; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index aa708197b6..7d3a185efc 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7099,6 +7099,103 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMPrefetchExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pMemory) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_USM_MIGRATION_FLAGS_MASK & flags) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + } + + ur_result_t result = pfnAppendUSMPrefetchExp( + hCommandBuffer, pMemory, size, flags, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + auto pfnAppendUSMAdviseExp = + context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hCommandBuffer) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == pMemory) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_USM_ADVICE_FLAGS_MASK & advice) { + return UR_RESULT_ERROR_INVALID_ENUMERATION; + } + + if (size == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + } + + ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, + advice, pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7656,6 +7753,14 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnAppendMemBufferFillExp = ur_validation_layer::urCommandBufferAppendMemBufferFillExp; + dditable.pfnAppendUSMPrefetchExp = pDdiTable->pfnAppendUSMPrefetchExp; + pDdiTable->pfnAppendUSMPrefetchExp = + ur_validation_layer::urCommandBufferAppendUSMPrefetchExp; + + dditable.pfnAppendUSMAdviseExp = pDdiTable->pfnAppendUSMAdviseExp; + pDdiTable->pfnAppendUSMAdviseExp = + ur_validation_layer::urCommandBufferAppendUSMAdviseExp; + dditable.pfnEnqueueExp = pDdiTable->pfnEnqueueExp; pDdiTable->pfnEnqueueExp = ur_validation_layer::urCommandBufferEnqueueExp; diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 06923cc062..da10512d08 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6783,6 +6783,81 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = + reinterpret_cast(hCommandBuffer) + ->dditable; + auto pfnAppendUSMPrefetchExp = + dditable->ur.CommandBufferExp.pfnAppendUSMPrefetchExp; + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // forward to device-platform + result = pfnAppendUSMPrefetchExp(hCommandBuffer, pMemory, size, flags, + numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urCommandBufferAppendUSMAdviseExp +__urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = + reinterpret_cast(hCommandBuffer) + ->dditable; + auto pfnAppendUSMAdviseExp = + dditable->ur.CommandBufferExp.pfnAppendUSMAdviseExp; + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hCommandBuffer = + reinterpret_cast(hCommandBuffer) + ->handle; + + // forward to device-platform + result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + pSyncPoint); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urCommandBufferEnqueueExp __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( @@ -7326,6 +7401,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( ur_loader::urCommandBufferAppendMemBufferReadRectExp; pDdiTable->pfnAppendMemBufferFillExp = ur_loader::urCommandBufferAppendMemBufferFillExp; + pDdiTable->pfnAppendUSMPrefetchExp = + ur_loader::urCommandBufferAppendUSMPrefetchExp; + pDdiTable->pfnAppendUSMAdviseExp = + ur_loader::urCommandBufferAppendUSMAdviseExp; pDdiTable->pfnEnqueueExp = ur_loader::urCommandBufferEnqueueExp; } else { // return pointers directly to platform's DDIs diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index ee9135dd59..9775a3283d 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7611,6 +7611,100 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendUSMPrefetchExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMPrefetchExp; + if (nullptr == pfnAppendUSMPrefetchExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendUSMPrefetchExp(hCommandBuffer, pMemory, size, flags, + numSyncPointsInWaitList, pSyncPointWaitList, + pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. + ) try { + auto pfnAppendUSMAdviseExp = + ur_lib::context->urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; + if (nullptr == pfnAppendUSMAdviseExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + pSyncPoint); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 7ecf3596db..4272c259ff 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6424,6 +6424,83 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Prefetch command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_MIGRATION_FLAGS_MASK & flags` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. + ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Append a USM Advise command to a command-buffer object +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hCommandBuffer` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pMemory` +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// + `::UR_USM_ADVICE_FLAGS_MASK & advice` +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `size == 0` +/// + If `size` is higher than the allocation size of `pMemory` +/// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY +/// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES +ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( + ur_exp_command_buffer_handle_t + hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + ur_exp_command_buffer_sync_point_t * + pSyncPoint ///< [out][optional] sync point associated with this command. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Submit a command-buffer for execution on a queue. /// From 57b452cf55d72c54aded750c83e87ecb8588882d Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 09:22:19 +0100 Subject: [PATCH 039/145] Update scripts/core/EXP-COMMAND-BUFFER.rst Co-authored-by: Ewan Crawford --- scripts/core/EXP-COMMAND-BUFFER.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/core/EXP-COMMAND-BUFFER.rst b/scripts/core/EXP-COMMAND-BUFFER.rst index d7c7f6cd13..a6a32a66a1 100644 --- a/scripts/core/EXP-COMMAND-BUFFER.rst +++ b/scripts/core/EXP-COMMAND-BUFFER.rst @@ -224,7 +224,7 @@ Changelog +-----------+-------------------------------------------------------+ | 1.2 | Add function definitions for fill commands | +-----------+-------------------------------------------------------+ -| 1.2 | Add function definitions for Prefetch and Advise | +| 1.3 | Add function definitions for Prefetch and Advise | | | commands | +-----------+-------------------------------------------------------+ From 043b4d2705b2ca9a353c335ef5f47caeeda01bbf Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 09:23:30 +0100 Subject: [PATCH 040/145] Update scripts/core/exp-command-buffer.yml Co-authored-by: Ewan Crawford --- scripts/core/exp-command-buffer.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 553adcd9ce..cda58a1818 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -630,6 +630,9 @@ type: function desc: "Append a USM Advise command to a command-buffer object" class: $xCommandBuffer name: AppendUSMAdviseExp +details: + - "Not all memory advice hints may be supported for all devices or allocation types. + If a memory advice hint is not supported, it will be ignored." params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer From 267c89f4bcb974d70fa2648d0d1025e00a36e0c6 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 09:35:37 +0100 Subject: [PATCH 041/145] [SYCL][Graph] Adds a detail section in the comment of bith functions --- include/ur_api.h | 10 ++++++++++ scripts/core/exp-command-buffer.yml | 3 +++ source/loader/ur_libapi.cpp | 10 ++++++++++ source/ur_api.cpp | 10 ++++++++++ 4 files changed, 33 insertions(+) diff --git a/include/ur_api.h b/include/ur_api.h index d9a65f4683..26b96576c1 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8164,6 +8164,11 @@ urCommandBufferAppendMemBufferFillExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Prefetch command to a command-buffer object /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -8200,6 +8205,11 @@ urCommandBufferAppendUSMPrefetchExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Advise command to a command-buffer object /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index cda58a1818..821ba88a61 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -591,6 +591,9 @@ type: function desc: "Append a USM Prefetch command to a command-buffer object" class: $xCommandBuffer name: AppendUSMPrefetchExp +details: + - "Prefetching may not be supported for all devices or allocation types. If memory prefetching + is not supported, the prefetch hint will be ignored." params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 9775a3283d..03542befdf 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7614,6 +7614,11 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Prefetch command to a command-buffer object /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -7665,6 +7670,11 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Advise command to a command-buffer object /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 4272c259ff..ac284c24cc 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6427,6 +6427,11 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Prefetch command to a command-buffer object /// +/// @details +/// - Prefetching may not be supported for all devices or allocation types. +/// If memory prefetching is not supported, the prefetch hint will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED @@ -6469,6 +6474,11 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /////////////////////////////////////////////////////////////////////////////// /// @brief Append a USM Advise command to a command-buffer object /// +/// @details +/// - Not all memory advice hints may be supported for all devices or +/// allocation types. If a memory advice hint is not supported, it will be +/// ignored. +/// /// @returns /// - ::UR_RESULT_SUCCESS /// - ::UR_RESULT_ERROR_UNINITIALIZED From b12b606c35bb7469c1dfdf932e2917238635f02d Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 11:42:18 +0100 Subject: [PATCH 042/145] [SYCL][Graph] Adds dependencies to the Advise function --- include/ur.py | 4 ++-- include/ur_api.h | 14 +++++++++----- include/ur_ddi.h | 2 ++ scripts/core/exp-command-buffer.yml | 6 ++++++ source/adapters/null/ur_nullddi.cpp | 7 ++++++- source/common/ur_params.hpp | 10 ++++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 15 +++++++++++++-- source/loader/layers/validation/ur_valddi.cpp | 7 ++++++- source/loader/ur_ldrddi.cpp | 5 +++++ source/loader/ur_libapi.cpp | 5 +++++ source/ur_api.cpp | 4 ++++ 11 files changed, 68 insertions(+), 11 deletions(-) diff --git a/include/ur.py b/include/ur.py index 95582d636c..c3cb845e12 100644 --- a/include/ur.py +++ b/include/ur.py @@ -3628,9 +3628,9 @@ class ur_usm_exp_dditable_t(Structure): ############################################################################### ## @brief Function-pointer for urCommandBufferAppendUSMAdviseExp if __use_win_types: - _urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMAdviseExp_t = WINFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) else: - _urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, POINTER(ur_exp_command_buffer_sync_point_t) ) + _urCommandBufferAppendUSMAdviseExp_t = CFUNCTYPE( ur_result_t, ur_exp_command_buffer_handle_t, c_void_p, c_size_t, ur_usm_advice_flags_t, c_ulong, POINTER(ur_exp_command_buffer_sync_point_t), POINTER(ur_exp_command_buffer_sync_point_t) ) ############################################################################### ## @brief Function-pointer for urCommandBufferEnqueueExp diff --git a/include/ur_api.h b/include/ur_api.h index 26b96576c1..4b56a41dd3 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8231,11 +8231,13 @@ urCommandBufferAppendUSMPrefetchExp( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( - ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. - size_t size, ///< [in] size in bytes to be advised. - ur_usm_advice_flags_t advice, ///< [in] USM memory advice - ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. + ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. + void *pMemory, ///< [in] pointer to the USM memory object. + size_t size, ///< [in] size in bytes to be advised. + ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. + ur_exp_command_buffer_sync_point_t *pSyncPoint ///< [out][optional] sync point associated with this command. ); /////////////////////////////////////////////////////////////////////////////// @@ -10434,6 +10436,8 @@ typedef struct ur_command_buffer_append_usm_advise_exp_params_t { void **ppMemory; size_t *psize; ur_usm_advice_flags_t *padvice; + uint32_t *pnumSyncPointsInWaitList; + const ur_exp_command_buffer_sync_point_t **ppSyncPointWaitList; ur_exp_command_buffer_sync_point_t **ppSyncPoint; } ur_command_buffer_append_usm_advise_exp_params_t; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index bd8878aab9..5638ad48cc 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1941,6 +1941,8 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( void *, size_t, ur_usm_advice_flags_t, + uint32_t, + const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *); /////////////////////////////////////////////////////////////////////////////// diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 821ba88a61..150656ca8a 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -649,6 +649,12 @@ params: - type: $x_usm_advice_flags_t name: advice desc: "[in] USM memory advice" + - type: uint32_t + name: numSyncPointsInWaitList + desc: "[in] The number of sync points in the provided dependency list." + - type: "const $x_exp_command_buffer_sync_point_t*" + name: pSyncPointWaitList + desc: "[in][optional] A list of sync points that this command depends on." - type: "$x_exp_command_buffer_sync_point_t*" name: pSyncPoint desc: "[out][optional] sync point associated with this command." diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 8f668fa12c..0b95f49e08 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4934,6 +4934,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) try { @@ -4944,7 +4948,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( d_context.urDdiTable.CommandBufferExp.pfnAppendUSMAdviseExp; if (nullptr != pfnAppendUSMAdviseExp) { result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, - pSyncPoint); + numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); } else { // generic implementation } diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 8bf5293f61..572922693d 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -11424,6 +11424,16 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct ur_params::serializeFlag(os, *(params->padvice)); + os << ", "; + os << ".numSyncPointsInWaitList = "; + + os << *(params->pnumSyncPointsInWaitList); + + os << ", "; + os << ".pSyncPointWaitList = "; + + ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + os << ", "; os << ".pSyncPoint = "; diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index c3c8a638d9..d5d7ab7c73 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5709,6 +5709,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { @@ -5720,13 +5724,20 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( } ur_command_buffer_append_usm_advise_exp_params_t params = { - &hCommandBuffer, &pMemory, &size, &advice, &pSyncPoint}; + &hCommandBuffer, + &pMemory, + &size, + &advice, + &numSyncPointsInWaitList, + &pSyncPointWaitList, + &pSyncPoint}; uint64_t instance = context.notify_begin(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, "urCommandBufferAppendUSMAdviseExp", ¶ms); ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, - advice, pSyncPoint); + advice, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); context.notify_end(UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP, "urCommandBufferAppendUSMAdviseExp", ¶ms, &result, diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 7d3a185efc..c0e41121f7 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7162,6 +7162,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { @@ -7191,7 +7195,8 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( } ur_result_t result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, - advice, pSyncPoint); + advice, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint); return result; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index da10512d08..34d02e66ee 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6831,6 +6831,10 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { @@ -6853,6 +6857,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( // forward to device-platform result = pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); return result; diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 03542befdf..665b0410de 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7700,6 +7700,10 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) try { @@ -7710,6 +7714,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( } return pfnAppendUSMAdviseExp(hCommandBuffer, pMemory, size, advice, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint); } catch (...) { return exceptionToResult(std::current_exception()); diff --git a/source/ur_api.cpp b/source/ur_api.cpp index ac284c24cc..0a63ded4dd 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6504,6 +6504,10 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice + uint32_t + numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. + const ur_exp_command_buffer_sync_point_t * + pSyncPointWaitList, ///< [in][optional] A list of sync points that this command depends on. ur_exp_command_buffer_sync_point_t * pSyncPoint ///< [out][optional] sync point associated with this command. ) { From 78639a22e5ad40e32ec1444313fc03b4d1b6f675 Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 12:48:56 +0100 Subject: [PATCH 043/145] [SYCL][Graph] Defines dest mem pointer as a const pointer --- include/ur_api.h | 8 ++++---- include/ur_ddi.h | 4 ++-- scripts/core/exp-command-buffer.yml | 4 ++-- source/adapters/null/ur_nullddi.cpp | 8 ++++---- source/loader/layers/tracing/ur_trcddi.cpp | 8 ++++---- source/loader/layers/validation/ur_valddi.cpp | 8 ++++---- source/loader/ur_ldrddi.cpp | 8 ++++---- source/loader/ur_libapi.cpp | 8 ++++---- source/ur_api.cpp | 8 ++++---- 9 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 4b56a41dd3..736d102237 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8194,7 +8194,7 @@ urCommandBufferAppendMemBufferFillExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -8232,7 +8232,7 @@ urCommandBufferAppendUSMPrefetchExp( UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -10419,7 +10419,7 @@ typedef struct ur_command_buffer_append_mem_buffer_fill_exp_params_t { /// allowing the callback the ability to modify the parameter's value typedef struct ur_command_buffer_append_usm_prefetch_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; - void **ppMemory; + const void **ppMemory; size_t *psize; ur_usm_migration_flags_t *pflags; uint32_t *pnumSyncPointsInWaitList; @@ -10433,7 +10433,7 @@ typedef struct ur_command_buffer_append_usm_prefetch_exp_params_t { /// allowing the callback the ability to modify the parameter's value typedef struct ur_command_buffer_append_usm_advise_exp_params_t { ur_exp_command_buffer_handle_t *phCommandBuffer; - void **ppMemory; + const void **ppMemory; size_t *psize; ur_usm_advice_flags_t *padvice; uint32_t *pnumSyncPointsInWaitList; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 5638ad48cc..246ffc200d 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -1927,7 +1927,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendMemBufferFillExp_t)( /// @brief Function-pointer for urCommandBufferAppendUSMPrefetchExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( ur_exp_command_buffer_handle_t, - void *, + const void *, size_t, ur_usm_migration_flags_t, uint32_t, @@ -1938,7 +1938,7 @@ typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMPrefetchExp_t)( /// @brief Function-pointer for urCommandBufferAppendUSMAdviseExp typedef ur_result_t(UR_APICALL *ur_pfnCommandBufferAppendUSMAdviseExp_t)( ur_exp_command_buffer_handle_t, - void *, + const void *, size_t, ur_usm_advice_flags_t, uint32_t, diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 150656ca8a..50d6dd6bd3 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -598,7 +598,7 @@ params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer desc: "[in] handle of the command-buffer object." - - type: "void*" + - type: "const void*" name: pMemory desc: "[in] pointer to USM allocated memory to prefetch." - type: "size_t" @@ -640,7 +640,7 @@ params: - type: $x_exp_command_buffer_handle_t name: hCommandBuffer desc: "[in] handle of the command-buffer object." - - type: "void*" + - type: "const void*" name: pMemory desc: "[in] pointer to the USM memory object." - type: "size_t" diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index 0b95f49e08..a8a4883aa1 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -4897,9 +4897,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -4931,7 +4931,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index d5d7ab7c73..018d245da3 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -5660,9 +5660,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -5706,7 +5706,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index c0e41121f7..cc898a5fe5 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7103,9 +7103,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -7159,7 +7159,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 34d02e66ee..54c8f9b4c1 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -6787,9 +6787,9 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// @brief Intercept function for urCommandBufferAppendUSMPrefetchExp __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -6828,7 +6828,7 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 665b0410de..4e434aac18 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7643,9 +7643,9 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -7697,7 +7697,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 0a63ded4dd..bf9a65ac30 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6456,9 +6456,9 @@ ur_result_t UR_APICALL urCommandBufferAppendMemBufferFillExp( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_exp_command_buffer_handle_t - hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. - size_t size, ///< [in] size in bytes to be fetched. + hCommandBuffer, ///< [in] handle of the command-buffer object. + const void *pMemory, ///< [in] pointer to USM allocated memory to prefetch. + size_t size, ///< [in] size in bytes to be fetched. ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numSyncPointsInWaitList, ///< [in] The number of sync points in the provided dependency list. @@ -6501,7 +6501,7 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( ur_exp_command_buffer_handle_t hCommandBuffer, ///< [in] handle of the command-buffer object. - void *pMemory, ///< [in] pointer to the USM memory object. + const void *pMemory, ///< [in] pointer to the USM memory object. size_t size, ///< [in] size in bytes to be advised. ur_usm_advice_flags_t advice, ///< [in] USM memory advice uint32_t From 0cbc511f19ede09320125be8129b9a921374ad35 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Wed, 6 Sep 2023 14:42:37 +0200 Subject: [PATCH 044/145] Add a basic pool manager for memory pools --- source/common/ur_pool_manager.hpp | 121 ++++++++++++++++++++++++------ 1 file changed, 97 insertions(+), 24 deletions(-) diff --git a/source/common/ur_pool_manager.hpp b/source/common/ur_pool_manager.hpp index c4da5d149f..6e70c29e21 100644 --- a/source/common/ur_pool_manager.hpp +++ b/source/common/ur_pool_manager.hpp @@ -11,11 +11,17 @@ #ifndef USM_POOL_MANAGER_HPP #define USM_POOL_MANAGER_HPP 1 +#include "logger/ur_logger.hpp" +#include "umf_helpers.hpp" +#include "umf_pools/disjoint_pool.hpp" #include "ur_api.h" -#include "ur_pool_manager.hpp" #include "ur_util.hpp" +#include +#include + #include +#include #include namespace usm { @@ -29,8 +35,9 @@ struct pool_descriptor { ur_usm_type_t type; bool deviceReadOnly; - static bool equal(const pool_descriptor &lhs, const pool_descriptor &rhs); - static std::size_t hash(const pool_descriptor &desc); + bool operator==(const pool_descriptor &other) const; + friend std::ostream &operator<<(std::ostream &os, + const pool_descriptor &desc); static std::pair> create(ur_usm_pool_handle_t poolHandle, ur_context_handle_t hContext); }; @@ -75,10 +82,10 @@ urGetSubDevices(ur_device_handle_t hDevice) { inline std::pair> urGetAllDevicesAndSubDevices(ur_context_handle_t hContext) { - size_t deviceCount; + size_t deviceCount = 0; auto ret = urContextGetInfo(hContext, UR_CONTEXT_INFO_NUM_DEVICES, sizeof(deviceCount), &deviceCount, nullptr); - if (ret != UR_RESULT_SUCCESS) { + if (ret != UR_RESULT_SUCCESS || deviceCount == 0) { return {ret, {}}; } @@ -122,22 +129,28 @@ isSharedAllocationReadOnlyOnDevice(const pool_descriptor &desc) { return desc.type == UR_USM_TYPE_SHARED && desc.deviceReadOnly; } -inline bool pool_descriptor::equal(const pool_descriptor &lhs, - const pool_descriptor &rhs) { - ur_native_handle_t lhsNative, rhsNative; +inline bool pool_descriptor::operator==(const pool_descriptor &other) const { + const pool_descriptor &lhs = *this; + const pool_descriptor &rhs = other; + ur_native_handle_t lhsNative = nullptr, rhsNative = nullptr; // We want to share a memory pool for sub-devices and sub-sub devices. // Sub-devices and sub-sub-devices might be represented by different ur_device_handle_t but // they share the same native_handle_t (which is used by UMF provider). // Ref: https://github.com/intel/llvm/commit/86511c5dc84b5781dcfd828caadcb5cac157eae1 // TODO: is this L0 specific? - auto ret = urDeviceGetNativeHandle(lhs.hDevice, &lhsNative); - if (ret != UR_RESULT_SUCCESS) { - throw ret; + if (lhs.hDevice) { + auto ret = urDeviceGetNativeHandle(lhs.hDevice, &lhsNative); + if (ret != UR_RESULT_SUCCESS) { + throw ret; + } } - ret = urDeviceGetNativeHandle(rhs.hDevice, &rhsNative); - if (ret != UR_RESULT_SUCCESS) { - throw ret; + + if (rhs.hDevice) { + auto ret = urDeviceGetNativeHandle(rhs.hDevice, &rhsNative); + if (ret != UR_RESULT_SUCCESS) { + throw ret; + } } return lhsNative == rhsNative && lhs.type == rhs.type && @@ -146,16 +159,12 @@ inline bool pool_descriptor::equal(const pool_descriptor &lhs, lhs.poolHandle == rhs.poolHandle; } -inline std::size_t pool_descriptor::hash(const pool_descriptor &desc) { - ur_native_handle_t native; - auto ret = urDeviceGetNativeHandle(desc.hDevice, &native); - if (ret != UR_RESULT_SUCCESS) { - throw ret; - } - - return combine_hashes(0, desc.type, native, - isSharedAllocationReadOnlyOnDevice(desc), - desc.poolHandle); +inline std::ostream &operator<<(std::ostream &os, const pool_descriptor &desc) { + os << "pool handle: " << desc.poolHandle + << " context handle: " << desc.hContext + << " device handle: " << desc.hDevice << " memory type: " << desc.type + << " is read only: " << desc.deviceReadOnly; + return os; } inline std::pair> @@ -177,6 +186,7 @@ pool_descriptor::create(ur_usm_pool_handle_t poolHandle, pool_descriptor &desc = descriptors.emplace_back(); desc.poolHandle = poolHandle; desc.hContext = hContext; + desc.hDevice = device; desc.type = UR_USM_TYPE_DEVICE; } { @@ -200,6 +210,69 @@ pool_descriptor::create(ur_usm_pool_handle_t poolHandle, return {ret, descriptors}; } +template struct pool_manager { + private: + using desc_to_pool_map_t = std::unordered_map; + + desc_to_pool_map_t descToPoolMap; + + public: + static std::pair + create(desc_to_pool_map_t descToHandleMap = {}) { + auto manager = pool_manager(); + + for (auto &[desc, hPool] : descToHandleMap) { + auto ret = manager.addPool(desc, hPool); + if (ret != UR_RESULT_SUCCESS) { + return {ret, pool_manager()}; + } + } + + return {UR_RESULT_SUCCESS, std::move(manager)}; + } + + ur_result_t addPool(const D &desc, + umf::pool_unique_handle_t &hPool) noexcept { + if (!descToPoolMap.try_emplace(desc, std::move(hPool)).second) { + logger::error("Pool for pool descriptor: {}, already exists", desc); + return UR_RESULT_ERROR_INVALID_ARGUMENT; + } + + return UR_RESULT_SUCCESS; + } + + std::optional getPool(const D &desc) noexcept { + auto it = descToPoolMap.find(desc); + if (it == descToPoolMap.end()) { + logger::error("Pool descriptor doesn't match any existing pool: {}", + desc); + return std::nullopt; + } + + return it->second.get(); + } +}; + } // namespace usm +namespace std { +/// @brief hash specialization for usm::pool_descriptor +template <> struct hash { + inline size_t operator()(const usm::pool_descriptor &desc) const { + ur_native_handle_t native = nullptr; + if (desc.hDevice) { + auto ret = urDeviceGetNativeHandle(desc.hDevice, &native); + if (ret != UR_RESULT_SUCCESS) { + throw ret; + } + } + + return combine_hashes(0, desc.type, native, + isSharedAllocationReadOnlyOnDevice(desc), + desc.poolHandle); + } +}; + +} // namespace std + #endif /* USM_POOL_MANAGER_HPP */ From 92684c52b5dcf0fdc4a26b8c0f8812c0f8bd640e Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Thu, 21 Sep 2023 16:31:09 +0100 Subject: [PATCH 045/145] Temporarily disable running check-generated target in windows CI. See issue #888 --- .github/workflows/cmake.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index c4e25f28e5..9348c5b504 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -123,9 +123,10 @@ jobs: -DUR_BUILD_TESTS=ON -DUR_FORMAT_CPP_STYLE=ON - - name: Generate source from spec, check for uncommitted diff - if: matrix.os == 'windows-2022' - run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}} + # TODO: re-enable when check-generated is fixed for windows runners see #888 + # - name: Generate source from spec, check for uncommitted diff + # if: matrix.os == 'windows-2022' + # run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}} - name: Build all run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j 2 From 12b734169ad2b306abed605c9433ba3e941787de Mon Sep 17 00:00:00 2001 From: Maxime France-Pillois Date: Mon, 25 Sep 2023 18:09:38 +0100 Subject: [PATCH 046/145] Updates error conditions for USM advise --- include/ur_api.h | 3 +++ scripts/core/exp-command-buffer.yml | 3 +++ source/loader/layers/validation/ur_valddi.cpp | 8 ++++++++ source/loader/ur_libapi.cpp | 3 +++ source/ur_api.cpp | 3 +++ 5 files changed, 20 insertions(+) diff --git a/include/ur_api.h b/include/ur_api.h index 736d102237..81884a7680 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -8223,6 +8223,9 @@ urCommandBufferAppendUSMPrefetchExp( /// + `::UR_USM_ADVICE_FLAGS_MASK & advice` /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `size == 0` diff --git a/scripts/core/exp-command-buffer.yml b/scripts/core/exp-command-buffer.yml index 50d6dd6bd3..7d1b686aab 100644 --- a/scripts/core/exp-command-buffer.yml +++ b/scripts/core/exp-command-buffer.yml @@ -661,6 +661,9 @@ params: returns: - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP + - $X_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: + - "`pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0`" + - "`pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0`" - $X_RESULT_ERROR_INVALID_MEM_OBJECT - $X_RESULT_ERROR_INVALID_SIZE: - "`size == 0`" diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index cc898a5fe5..43b6902832 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -7189,6 +7189,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferAppendUSMAdviseExp( return UR_RESULT_ERROR_INVALID_ENUMERATION; } + if (pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + + if (pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0) { + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; + } + if (size == 0) { return UR_RESULT_ERROR_INVALID_SIZE; } diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 4e434aac18..d86d9606fa 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -7688,6 +7688,9 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /// + `::UR_USM_ADVICE_FLAGS_MASK & advice` /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `size == 0` diff --git a/source/ur_api.cpp b/source/ur_api.cpp index bf9a65ac30..6f3d0c74a7 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -6492,6 +6492,9 @@ ur_result_t UR_APICALL urCommandBufferAppendUSMPrefetchExp( /// + `::UR_USM_ADVICE_FLAGS_MASK & advice` /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP /// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP +/// - ::UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP +/// + `pSyncPointWaitList == NULL && numSyncPointsInWaitList > 0` +/// + `pSyncPointWaitList != NULL && numSyncPointsInWaitList == 0` /// - ::UR_RESULT_ERROR_INVALID_MEM_OBJECT /// - ::UR_RESULT_ERROR_INVALID_SIZE /// + `size == 0` From 91ce81c9334539a798615af21f57af180132ed39 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Mon, 25 Sep 2023 17:16:57 +0100 Subject: [PATCH 047/145] Install doxygen on windows runners, re-enable generating spec on windows --- .github/workflows/cmake.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9348c5b504..fa82331fdb 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -111,6 +111,13 @@ jobs: - name: Install prerequisites run: python3 -m pip install -r third_party/requirements.txt + - name: Install doxygen + run: | + $WorkingDir = $PWD.Path + Invoke-WebRequest -Uri https://github.com/doxygen/doxygen/releases/download/Release_1_9_8/doxygen-1.9.8.windows.x64.bin.zip -OutFile "$WorkingDir\doxygen.zip" + Expand-Archive -Path "$WorkingDir\doxygen.zip" + Add-Content $env:GITHUB_PATH "$WorkingDir\doxygen" + - name: Configure CMake run: > cmake @@ -123,10 +130,9 @@ jobs: -DUR_BUILD_TESTS=ON -DUR_FORMAT_CPP_STYLE=ON - # TODO: re-enable when check-generated is fixed for windows runners see #888 - # - name: Generate source from spec, check for uncommitted diff - # if: matrix.os == 'windows-2022' - # run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}} + - name: Generate source from spec, check for uncommitted diff + if: matrix.os == 'windows-2022' + run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}} - name: Build all run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j 2 From fd2702a71d3b17e804d9d92d42a944526f4f16d4 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 26 Sep 2023 13:58:09 +0100 Subject: [PATCH 048/145] Document release process Fixes #806 by documenting the release process used for the v0.7 release cycle in the project [README](README.md). --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d97848ecc4..762b4b37e1 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ - [Adapter naming convention](#adapter-naming-convention) - [Source code generation](#source-code-generation) - [Documentation](#documentation) - +6. [Release Process](#release-process) ## Contents of the repo @@ -166,3 +166,26 @@ Code is generated using included [Python scripts](/scripts/README.md). Documentation is generated from source code using Sphinx - see [scripts dir](/scripts/README.md) for details. + +## Release Process + +Unified Runtime releases are aligned with oneAPI releases. Once all changes +planned for a release have been accepted, the release process is defined as: + +1. Create a new release branch based on the [main][main-branch] branch taking + the form `v..x` where `x` is a placeholder for the patch + version. This branch will always contain the latest patch version for a given + release. +2. Create a PR to increment the CMake project version on the [main][main-branch] + and merge before accepting any other changes. +3. Create a new tag based on the latest commit on the release branch taking the + form `v..`. +4. Create a [new GitHub release][new-github-release] using the tag created in + the previous step. + * Prior to version 1.0, check the *Set as a pre-release* tick box. +5. Update downstream projects to utilize the release tag. If any issues arise + from integration, apply any necessary hot fixes to `v..x` + branch and go back to step 3. + +[main-branch]: https://github.com/oneapi-src/unified-runtime/tree/main +[new-github-release]: https://github.com/oneapi-src/unified-runtime/releases/new From 8c56438d54e17789022c31048da13dde42016459 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Wed, 6 Sep 2023 14:43:05 +0200 Subject: [PATCH 049/145] Add pool manager tests --- test/usm/CMakeLists.txt | 8 +++- test/usm/usmPoolManager.cpp | 77 +++++++++++++++++++++++++++++++++---- 2 files changed, 76 insertions(+), 9 deletions(-) diff --git a/test/usm/CMakeLists.txt b/test/usm/CMakeLists.txt index b673b6d1b9..fa5454d4db 100644 --- a/test/usm/CMakeLists.txt +++ b/test/usm/CMakeLists.txt @@ -10,6 +10,8 @@ function(add_usm_test name) add_ur_executable(${TEST_TARGET_NAME} ${UR_USM_TEST_DIR}/../conformance/source/environment.cpp ${UR_USM_TEST_DIR}/../conformance/source/main.cpp + ${UR_USM_TEST_DIR}/../unified_malloc_framework/common/provider.c + ${UR_USM_TEST_DIR}/../unified_malloc_framework/common/pool.c ${ARGN}) target_link_libraries(${TEST_TARGET_NAME} PRIVATE @@ -17,10 +19,12 @@ function(add_usm_test name) ${PROJECT_NAME}::loader ur_testing GTest::gtest_main) - add_test(NAME usm-${name} + add_test(NAME usm-${name} COMMAND ${TEST_TARGET_NAME} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(usm-${name} PROPERTIES LABELS "usm") + set_tests_properties(usm-${name} PROPERTIES + LABELS "usm" + ENVIRONMENT "UR_ADAPTERS_FORCE_LOAD=\"$\"") target_compile_definitions("usm_test-${name}" PRIVATE DEVICES_ENVIRONMENT) endfunction() diff --git a/test/usm/usmPoolManager.cpp b/test/usm/usmPoolManager.cpp index eaf44e119d..4365a5ce7b 100644 --- a/test/usm/usmPoolManager.cpp +++ b/test/usm/usmPoolManager.cpp @@ -3,19 +3,18 @@ // See LICENSE.TXT // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -#include "../unified_malloc_framework/common/pool.hpp" -#include "../unified_malloc_framework/common/provider.hpp" #include "ur_pool_manager.hpp" -#include +#include "../unified_malloc_framework/common/pool.h" +#include "../unified_malloc_framework/common/provider.h" -#include +#include -struct urUsmPoolManagerTest +struct urUsmPoolDescriptorTest : public uur::urMultiDeviceContextTest, ::testing::WithParamInterface {}; -TEST_P(urUsmPoolManagerTest, poolIsPerContextTypeAndDevice) { +TEST_P(urUsmPoolDescriptorTest, poolIsPerContextTypeAndDevice) { auto &devices = uur::DevicesEnvironment::instance->devices; auto poolHandle = this->GetParam(); @@ -49,7 +48,71 @@ TEST_P(urUsmPoolManagerTest, poolIsPerContextTypeAndDevice) { ASSERT_EQ(sharedPools, devices.size() * 2); } -INSTANTIATE_TEST_SUITE_P(urUsmPoolManagerTest, urUsmPoolManagerTest, +INSTANTIATE_TEST_SUITE_P(urUsmPoolDescriptorTest, urUsmPoolDescriptorTest, ::testing::Values(nullptr)); // TODO: add test with sub-devices + +struct urUsmPoolManagerTest : public uur::urContextTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urContextTest::SetUp()); + auto [ret, descs] = usm::pool_descriptor::create(nullptr, context); + ASSERT_EQ(ret, UR_RESULT_SUCCESS); + poolDescriptors = descs; + } + + std::vector poolDescriptors; +}; + +TEST_P(urUsmPoolManagerTest, poolManagerPopulate) { + auto [ret, manager] = usm::pool_manager::create(); + ASSERT_EQ(ret, UR_RESULT_SUCCESS); + + for (auto &desc : poolDescriptors) { + // Populate the pool manager + auto pool = nullPoolCreate(); + ASSERT_NE(pool, nullptr); + auto poolUnique = umf::pool_unique_handle_t(pool, umfPoolDestroy); + ASSERT_NE(poolUnique, nullptr); + ret = manager.addPool(desc, poolUnique); + ASSERT_EQ(ret, UR_RESULT_SUCCESS); + } + + for (auto &desc : poolDescriptors) { + // Confirm that there is a pool for each descriptor + auto hPoolOpt = manager.getPool(desc); + ASSERT_TRUE(hPoolOpt.has_value()); + ASSERT_NE(hPoolOpt.value(), nullptr); + } +} + +TEST_P(urUsmPoolManagerTest, poolManagerInsertExisting) { + auto [ret, manager] = usm::pool_manager::create(); + ASSERT_EQ(ret, UR_RESULT_SUCCESS); + + auto desc = poolDescriptors[0]; + + auto pool = nullPoolCreate(); + ASSERT_NE(pool, nullptr); + auto poolUnique = umf::pool_unique_handle_t(pool, umfPoolDestroy); + ASSERT_NE(poolUnique, nullptr); + + ret = manager.addPool(desc, poolUnique); + ASSERT_EQ(ret, UR_RESULT_SUCCESS); + + // Inserting an existing key should return an error + ret = manager.addPool(desc, poolUnique); + ASSERT_EQ(ret, UR_RESULT_ERROR_INVALID_ARGUMENT); +} + +TEST_P(urUsmPoolManagerTest, poolManagerGetNonexistant) { + auto [ret, manager] = usm::pool_manager::create(); + ASSERT_EQ(ret, UR_RESULT_SUCCESS); + + for (auto &desc : poolDescriptors) { + auto hPool = manager.getPool(desc); + ASSERT_FALSE(hPool.has_value()); + } +} + +UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urUsmPoolManagerTest); From 97cdc41c0801ce3c148244ef050b62b27240ef2d Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Wed, 27 Sep 2023 17:32:05 +0100 Subject: [PATCH 050/145] Include function pointer typedefs in generated spec documents. --- scripts/templates/api_listing.mako | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/templates/api_listing.mako b/scripts/templates/api_listing.mako index 722a803915..252c5ee887 100644 --- a/scripts/templates/api_listing.mako +++ b/scripts/templates/api_listing.mako @@ -115,7 +115,7 @@ ${title} ## ------------------------- <%isempty = True%> %for obj in objects: -%if re.match(r"typedef", obj['type']): +%if re.match(r"typedef", obj['type']) or re.match(r"fptr_typedef", obj['type']): %if isempty: # only display section title if there is content. %if needstitle: <%needstitle = False%> @@ -245,7 +245,7 @@ ${th.make_type_name(n, tags, obj)} ## ------------------------- <%isempty = True%> %for obj in objects: -%if re.match(r"typedef", obj['type']): +%if re.match(r"typedef", obj['type']) or re.match(r"fptr_typedef", obj['type']): %if isempty: # only display section title if there is content. ${title} Typedefs -------------------------------------------------------------------------------- From d61b8f05ad4a324cd72e056a8fcb3a2607b1c84c Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Mon, 25 Sep 2023 11:41:22 +0100 Subject: [PATCH 051/145] Another small batch of CTS fixes Mostly these are consistency related: * Add missing EventWait to event fixture * Set isNativeHandleOwned to false in KernelCreateWithNativeHandleTest * Use more commonly supported UR_QUEUE_INFO_CONTEXT query in QueueCreateWithNativeHandleTest * Add UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION path to QueueGetInfo test --- test/conformance/event/fixtures.h | 1 + .../kernel/urKernelCreateWithNativeHandle.cpp | 2 +- .../queue/urQueueCreateWithNativeHandle.cpp | 8 +++---- test/conformance/queue/urQueueGetInfo.cpp | 23 +++++++++++-------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/test/conformance/event/fixtures.h b/test/conformance/event/fixtures.h index c1d5f7a7da..ee16f2152d 100644 --- a/test/conformance/event/fixtures.h +++ b/test/conformance/event/fixtures.h @@ -65,6 +65,7 @@ struct urEventReferenceTest : uur::urProfilingQueueTest { input.assign(count, 42); ASSERT_SUCCESS(urEnqueueMemBufferWrite( queue, buffer, false, 0, size, input.data(), 0, nullptr, &event)); + ASSERT_SUCCESS(urEventWait(1, &event)); } void TearDown() override { diff --git a/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp b/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp index 83dd83f679..ab01069c82 100644 --- a/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp +++ b/test/conformance/kernel/urKernelCreateWithNativeHandle.cpp @@ -25,7 +25,7 @@ struct urKernelCreateWithNativeHandleTest : uur::urKernelTest { ur_kernel_native_properties_t properties = { UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES, /*sType*/ nullptr, /*pNext*/ - true /*isNativeHandleOwned*/ + false /*isNativeHandleOwned*/ }; }; UUR_INSTANTIATE_KERNEL_TEST_SUITE_P(urKernelCreateWithNativeHandleTest); diff --git a/test/conformance/queue/urQueueCreateWithNativeHandle.cpp b/test/conformance/queue/urQueueCreateWithNativeHandle.cpp index 01e7ca16d5..9f7588601f 100644 --- a/test/conformance/queue/urQueueCreateWithNativeHandle.cpp +++ b/test/conformance/queue/urQueueCreateWithNativeHandle.cpp @@ -23,9 +23,9 @@ TEST_P(urQueueCreateWithNativeHandleTest, Success) { &properties, &q)); ASSERT_NE(q, nullptr); - uint32_t q_size = 0; - ASSERT_SUCCESS(urQueueGetInfo(q, UR_QUEUE_INFO_SIZE, sizeof(uint32_t), - &q_size, nullptr)); - + ur_context_handle_t q_context = nullptr; + ASSERT_SUCCESS(urQueueGetInfo(q, UR_QUEUE_INFO_CONTEXT, sizeof(q_context), + &q_context, nullptr)); + ASSERT_EQ(q_context, context); ASSERT_SUCCESS(urQueueRelease(q)); } diff --git a/test/conformance/queue/urQueueGetInfo.cpp b/test/conformance/queue/urQueueGetInfo.cpp index 5f8100b612..9269e4de30 100644 --- a/test/conformance/queue/urQueueGetInfo.cpp +++ b/test/conformance/queue/urQueueGetInfo.cpp @@ -29,17 +29,22 @@ UUR_TEST_SUITE_P(urQueueGetInfoTestWithInfoParam, TEST_P(urQueueGetInfoTestWithInfoParam, Success) { ur_queue_info_t info_type = getParam(); size_t size = 0; - ASSERT_SUCCESS(urQueueGetInfo(queue, info_type, 0, nullptr, &size)); - ASSERT_NE(size, 0); + auto result = urQueueGetInfo(queue, info_type, 0, nullptr, &size); - if (const auto expected_size = queue_info_size_map.find(info_type); - expected_size != queue_info_size_map.end()) { - ASSERT_EQ(expected_size->second, size); - } + if (result == UR_RESULT_SUCCESS) { + ASSERT_NE(size, 0); + + if (const auto expected_size = queue_info_size_map.find(info_type); + expected_size != queue_info_size_map.end()) { + ASSERT_EQ(expected_size->second, size); + } - std::vector data(size); - ASSERT_SUCCESS( - urQueueGetInfo(queue, info_type, size, data.data(), nullptr)); + std::vector data(size); + ASSERT_SUCCESS( + urQueueGetInfo(queue, info_type, size, data.data(), nullptr)); + } else { + ASSERT_EQ_RESULT(result, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION); + } } using urQueueGetInfoTest = uur::urQueueTest; From 0657f06d9097ea84e81573ff90738cfd15de4852 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Wed, 27 Sep 2023 18:38:52 +0200 Subject: [PATCH 052/145] Change sub-device discovery mechanism in pool_descriptor::create() Currently, only the UR L0 adapter supports urDevicePartition function and it does not support partition type UR_DEVICE_PARTITION_EQUALLY. After this change, pool_descriptor::create() returns pool descriptors for main devices when sub-devices are unavailable instead of returning error. Also, the device partition type used for retrieving sub-devices was changed to UR_DEVICE_PARTITION_BY_CSLICE. --- source/common/ur_pool_manager.hpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/common/ur_pool_manager.hpp b/source/common/ur_pool_manager.hpp index 6e70c29e21..2215bd0575 100644 --- a/source/common/ur_pool_manager.hpp +++ b/source/common/ur_pool_manager.hpp @@ -52,8 +52,8 @@ urGetSubDevices(ur_device_handle_t hDevice) { } ur_device_partition_property_t prop; - prop.type = UR_DEVICE_PARTITION_EQUALLY; - prop.value.equally = nComputeUnits; + prop.type = UR_DEVICE_PARTITION_BY_CSLICE; + prop.value.affinity_domain = 0; ur_device_partition_properties_t properties{ UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES, @@ -117,6 +117,11 @@ urGetAllDevicesAndSubDevices(ur_context_handle_t hContext) { for (size_t i = 0; i < deviceCount; i++) { ret = addPoolsForDevicesRec(devices[i]); if (ret != UR_RESULT_SUCCESS) { + if (ret == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) { + // Return main devices when sub-devices are unsupported. + return {ret, std::move(devices)}; + } + return {ret, {}}; } } From 2c6f729bae2bf1f6c3723763c9273d01d814173b Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 28 Sep 2023 12:52:06 +0100 Subject: [PATCH 053/145] [ur] Document the Adapter Change Process Now that adapter implementations are coming to live in this repo we need a process to ensure we maintain the quality of changes in dependent projects such as [intel/llvm](https://github.com/intel/llvm). This patch updates the contribution guide to include a section titled *Adapter Change Process* which details the process to follow when making changes which affect the API/ABI or UR or the behaviour of adapters. --- scripts/core/CONTRIB.rst | 64 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/scripts/core/CONTRIB.rst b/scripts/core/CONTRIB.rst index 3264422c45..6b4a907e71 100644 --- a/scripts/core/CONTRIB.rst +++ b/scripts/core/CONTRIB.rst @@ -13,9 +13,19 @@ accepted into the project. .. important:: - Before making a contribution you *should* determine if the change should be - made directly to the core specification or introduced as an experimental - feature. The criteria we use to make this distinction are as follows: + Any contributions that fall into the following criteria *must* follow the + `Adapter Change Process`_: + + * Changing the API/ABI of the specification and or loader. + + * Changing the implementation of an adapter. + + * Changing the implementation of shared/common code used by an adapter. + + Before making a contribution to the specification you *should* determine if + the change should be made directly to the core specification or introduced + as an experimental feature. The criteria we use to make this distinction + are as follows: * The feature exists to enable an experimental feature in a parallel language runtime being built on top of Unified Runtime. @@ -39,6 +49,54 @@ accepted into the project. Runtime team via the `GitHub issue tracker `_. +Adapter Change Process +====================== + +1. Create a pull request containing the adapter changes in the + `oneapi-src/unified-runtime`_ project targeting the `adapters + `_ branch. + +2. Create a draft pull request in the `intel/llvm`_ project to take advantage + of the pre-merge testing. Add any required implementation changes in + addition to changing: + + * `UNIFIED_RUNTIME_REPO`_ to point at your fork of Unified Runtime. + + * `UNIFIED_RUNTIME_TAG`_ to point at your development branch name used to + create the Unified Runtime pull request in step 1. + +3. Add a comment in the *oneapi-src/unified-runtime* pull request linking to + the *intel/llvm* pull request created in step 2. + +4. Code reviews for the adapter changes are carried out in the + *oneapi-src/unified-runtime* pull request. + +5. Any new commits to the *oneapi-src/unified-runtime* pull request *must* be + accompanied by a corresponding update in the *intel/llvm* pull request as + indicated in step 2, so the testing is always up-to-date. + +6. The Unified Runtime maintainers *must* ensure that step 5 has been carried + out and that all pre-merge testing has passed before accepting the + *oneapi-src/unified-runtime* pull request. + +7. Once the *oneapi-src/unified-runtime* pull request is accepted: + + * Reverse the change to `UNIFIED_RUNTIME_REPO`_ made in step 2. + * Update the `UNIFIED_RUNTIME_TAG`_ to point at the + *oneapi-src/unified-runtime* commit/tag containing the merged adapter + changes. + * Mark the *intel/llvm* pull request as ready for review and follow their + review process. + +.. _oneapi-src/unified-runtime: + https://github.com/oneapi-src/unified-runtime +.. _intel/llvm: + https://github.com/intel/llvm +.. _UNIFIED_RUNTIME_REPO: + https://github.com/intel/llvm/blob/sycl/sycl/plugins/unified_runtime/CMakeLists.txt#L7 +.. _UNIFIED_RUNTIME_TAG: + https://github.com/intel/llvm/blob/sycl/sycl/plugins/unified_runtime/CMakeLists.txt#L8 + Build Environment ================= From 3336a8306623ce63e4d76a3b59d61392324a74d5 Mon Sep 17 00:00:00 2001 From: Damian Duy Date: Thu, 3 Aug 2023 12:35:14 +0200 Subject: [PATCH 054/145] [umf] extend out of memory test for disjoint pool --- test/unified_malloc_framework/common/pool.hpp | 19 ++++++++- test/unified_malloc_framework/memoryPool.hpp | 41 +++++++++++++++++-- .../memoryPoolAPI.cpp | 13 +++--- .../umf_pools/disjoint_pool.cpp | 21 ++++------ 4 files changed, 69 insertions(+), 25 deletions(-) diff --git a/test/unified_malloc_framework/common/pool.hpp b/test/unified_malloc_framework/common/pool.hpp index 2671dfbbfb..f31acf8d22 100644 --- a/test/unified_malloc_framework/common/pool.hpp +++ b/test/unified_malloc_framework/common/pool.hpp @@ -23,6 +23,7 @@ #include #include "base.hpp" +#include "provider.hpp" #include "umf_helpers.hpp" namespace umf_test { @@ -31,6 +32,17 @@ auto wrapPoolUnique(umf_memory_pool_handle_t hPool) { return umf::pool_unique_handle_t(hPool, &umfPoolDestroy); } +template +auto makePoolWithOOMProvider(int allocNum, Args &&...args) { + auto [ret, provider] = + umf::memoryProviderMakeUnique(allocNum); + EXPECT_EQ(ret, UMF_RESULT_SUCCESS); + auto [retp, pool] = umf::poolMakeUnique( + {std::move(provider)}, std::forward(args)...); + EXPECT_EQ(retp, UMF_RESULT_SUCCESS); + return std::move(pool); +} + bool isReallocSupported(umf_memory_pool_handle_t hPool) { static constexpr size_t allocSize = 8; bool supported; @@ -128,10 +140,13 @@ struct proxy_pool : public pool_base { void *calloc(size_t num, size_t size) noexcept { void *ptr; auto ret = umfMemoryProviderAlloc(provider, num * size, 0, &ptr); + umf::getPoolLastStatusRef() = ret; - memset(ptr, 0, num * size); + if (!ptr) { + return ptr; + } - umf::getPoolLastStatusRef() = ret; + memset(ptr, 0, num * size); return ptr; } void *realloc([[maybe_unused]] void *ptr, diff --git a/test/unified_malloc_framework/memoryPool.hpp b/test/unified_malloc_framework/memoryPool.hpp index 963dafc062..ab923932fb 100644 --- a/test/unified_malloc_framework/memoryPool.hpp +++ b/test/unified_malloc_framework/memoryPool.hpp @@ -55,9 +55,27 @@ struct umfMultiPoolTest : umfPoolTest { std::vector pools; }; -struct umfMemTest : umfPoolTest { - void SetUp() override { umfPoolTest::SetUp(); } - void TearDown() override { umfPoolTest::TearDown(); } +struct umfMemTest + : umf_test::test, + ::testing::WithParamInterface< + std::tuple, int>> { + umfMemTest() : pool(nullptr, nullptr), expectedRecycledPoolAllocs(0) {} + void SetUp() override { + test::SetUp(); + initialize(); + } + + void TearDown() override { test::TearDown(); } + + void initialize() { + auto [pool_fun, expectedRecycledPoolAllocs] = this->GetParam(); + EXPECT_NE(pool_fun(), nullptr); + this->pool = pool_fun(); + this->expectedRecycledPoolAllocs = expectedRecycledPoolAllocs; + } + + umf::pool_unique_handle_t pool; + int expectedRecycledPoolAllocs; }; TEST_P(umfPoolTest, allocFree) { @@ -259,7 +277,7 @@ TEST_P(umfPoolTest, multiThreadedMallocFreeRandomSizes) { } TEST_P(umfMemTest, outOfMem) { - static constexpr size_t allocSize = 16; + static constexpr size_t allocSize = 4096; auto hPool = pool.get(); std::vector allocations; @@ -274,10 +292,25 @@ TEST_P(umfMemTest, outOfMem) { ASSERT_NE(allocations.back(), nullptr); } + // next part of the test- freeing some memory to allocate it again (as the memory + // should be acquired from the pool itself now, not from the provider), + // is done only for the disjoint pool for now + // remove last nullptr from the allocations vector ASSERT_EQ(allocations.back(), nullptr); allocations.pop_back(); + ASSERT_NE(allocations.back(), nullptr); + for (int i = 0; i < expectedRecycledPoolAllocs; i++) { + umfPoolFree(hPool, allocations.back()); + allocations.pop_back(); + } + + for (int i = 0; i < expectedRecycledPoolAllocs; i++) { + allocations.emplace_back(umfPoolMalloc(hPool, allocSize)); + ASSERT_NE(allocations.back(), nullptr); + } + for (auto allocation : allocations) { umfPoolFree(hPool, allocation); } diff --git a/test/unified_malloc_framework/memoryPoolAPI.cpp b/test/unified_malloc_framework/memoryPoolAPI.cpp index e471e1ecd4..82d3768611 100644 --- a/test/unified_malloc_framework/memoryPoolAPI.cpp +++ b/test/unified_malloc_framework/memoryPoolAPI.cpp @@ -158,13 +158,12 @@ INSTANTIATE_TEST_SUITE_P( })); INSTANTIATE_TEST_SUITE_P( - proxyPoolOOMTest, umfMemTest, ::testing::Values([] { - return umf::poolMakeUnique( - {umf::memoryProviderMakeUnique< - umf_test::provider_mock_out_of_mem>(10) - .second}) - .second; - })); + proxyPoolOOMTest, umfMemTest, + ::testing::Values(std::tuple( + [] { + return umf_test::makePoolWithOOMProvider(10); + }, + 0))); ////////////////// Negative test cases ///////////////// diff --git a/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp b/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp index c3c635577c..0e81342bef 100644 --- a/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp +++ b/test/unified_malloc_framework/umf_pools/disjoint_pool.cpp @@ -11,6 +11,7 @@ #include "disjoint_pool.hpp" #include "memoryPool.hpp" +#include "pool.hpp" #include "provider.h" #include "provider.hpp" @@ -33,16 +34,6 @@ static auto makePool() { return std::move(pool); } -static auto makePoolOOMProvider() { - auto [ret, provider] = - umf::memoryProviderMakeUnique(10); - EXPECT_EQ(ret, UMF_RESULT_SUCCESS); - auto [retp, pool] = umf::poolMakeUnique( - {std::move(provider)}, poolConfig()); - EXPECT_EQ(retp, UMF_RESULT_SUCCESS); - return std::move(pool); -} - using umf_test::test; TEST_F(test, freeErrorPropagation) { @@ -83,8 +74,14 @@ TEST_F(test, freeErrorPropagation) { INSTANTIATE_TEST_SUITE_P(disjointPoolTests, umfPoolTest, ::testing::Values(makePool)); -INSTANTIATE_TEST_SUITE_P(disjointPoolTests, umfMemTest, - ::testing::Values(makePoolOOMProvider)); +INSTANTIATE_TEST_SUITE_P( + disjointPoolTests, umfMemTest, + ::testing::Values(std::make_tuple( + [] { + return umf_test::makePoolWithOOMProvider( + static_cast(poolConfig().Capacity), poolConfig()); + }, + static_cast(poolConfig().Capacity) / 2))); GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfMultiPoolTest); INSTANTIATE_TEST_SUITE_P(disjointMultiPoolTests, umfMultiPoolTest, From 8c2156a322dbafd5df38ec0dddbbabdc70df21d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Fri, 29 Sep 2023 15:59:23 +0200 Subject: [PATCH 055/145] [UR] bump libxml requirement version as it cannot be found on (bare metal) Win Server 2022 --- third_party/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/requirements.txt b/third_party/requirements.txt index 3628039ede..9aff32b1a4 100644 --- a/third_party/requirements.txt +++ b/third_party/requirements.txt @@ -12,7 +12,7 @@ exhale==0.3.0 idna==2.8 imagesize==1.1.0 Jinja2==2.11.3 -lxml==4.9.1 +lxml==4.9.3 Mako==1.1.0 MarkupSafe==1.1.1 packaging==19.2 From ecd5ffd331a3d92d0526837f4860b35b0f425631 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Fri, 29 Sep 2023 17:22:05 +0100 Subject: [PATCH 056/145] Add extra validation to EventSetCallback and fix execution_info enum. --- include/ur.py | 8 ++-- include/ur_api.h | 16 ++++--- scripts/core/event.yml | 12 +++-- source/common/ur_params.hpp | 16 +++---- source/loader/layers/validation/ur_valddi.cpp | 6 ++- source/loader/ur_libapi.cpp | 6 ++- source/ur_api.cpp | 6 ++- test/conformance/event/urEventSetCallback.cpp | 47 +++++++------------ test/conformance/queue/urQueueFinish.cpp | 2 +- 9 files changed, 62 insertions(+), 57 deletions(-) diff --git a/include/ur.py b/include/ur.py index c3cb845e12..d949558c9c 100644 --- a/include/ur.py +++ b/include/ur.py @@ -2106,10 +2106,10 @@ class ur_event_native_properties_t(Structure): ############################################################################### ## @brief Event states for all events. class ur_execution_info_v(IntEnum): - EXECUTION_INFO_COMPLETE = 0 ## Indicates that the event has completed. - EXECUTION_INFO_RUNNING = 1 ## Indicates that the device has started processing this event. - EXECUTION_INFO_SUBMITTED = 2 ## Indicates that the event has been submitted by the host to the device. - EXECUTION_INFO_QUEUED = 3 ## Indicates that the event has been queued, this is the initial state of + COMPLETE = 0 ## Indicates that the event has completed. + RUNNING = 1 ## Indicates that the device has started processing this event. + SUBMITTED = 2 ## Indicates that the event has been submitted by the host to the device. + QUEUED = 3 ## Indicates that the event has been queued, this is the initial state of ## events. class ur_execution_info_t(c_int): diff --git a/include/ur_api.h b/include/ur_api.h index 81884a7680..37470abdb8 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -5687,11 +5687,11 @@ urEventCreateWithNativeHandle( /////////////////////////////////////////////////////////////////////////////// /// @brief Event states for all events. typedef enum ur_execution_info_t { - UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE = 0, ///< Indicates that the event has completed. - UR_EXECUTION_INFO_EXECUTION_INFO_RUNNING = 1, ///< Indicates that the device has started processing this event. - UR_EXECUTION_INFO_EXECUTION_INFO_SUBMITTED = 2, ///< Indicates that the event has been submitted by the host to the device. - UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED = 3, ///< Indicates that the event has been queued, this is the initial state of - ///< events. + UR_EXECUTION_INFO_COMPLETE = 0, ///< Indicates that the event has completed. + UR_EXECUTION_INFO_RUNNING = 1, ///< Indicates that the device has started processing this event. + UR_EXECUTION_INFO_SUBMITTED = 2, ///< Indicates that the event has been submitted by the host to the device. + UR_EXECUTION_INFO_QUEUED = 3, ///< Indicates that the event has been queued, this is the initial state of + ///< events. /// @cond UR_EXECUTION_INFO_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -5714,6 +5714,8 @@ typedef void (*ur_event_callback_t)( /// - The registered callback function will be called when the execution /// status of command associated with event changes to an execution status /// equal to or past the status specified by command_exec_status. +/// - `execStatus` must not be `UR_EXECUTION_INFO_QUEUED` as this is the +/// initial state of all events. /// - The application may call this function from simultaneous threads for /// the same context. /// - The implementation of this function should be thread-safe. @@ -5726,9 +5728,11 @@ typedef void (*ur_event_callback_t)( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hEvent` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED < execStatus` +/// + `::UR_EXECUTION_INFO_QUEUED < execStatus` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pfnNotify` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + `execStatus == UR_EXECUTION_INFO_QUEUED` UR_APIEXPORT ur_result_t UR_APICALL urEventSetCallback( ur_event_handle_t hEvent, ///< [in] handle of the event object diff --git a/scripts/core/event.yml b/scripts/core/event.yml index e34138d663..ba0ae968c8 100644 --- a/scripts/core/event.yml +++ b/scripts/core/event.yml @@ -319,13 +319,13 @@ desc: "Event states for all events." class: $xEvent name: $x_execution_info_t etors: - - name: EXECUTION_INFO_COMPLETE + - name: COMPLETE desc: "Indicates that the event has completed." - - name: EXECUTION_INFO_RUNNING + - name: RUNNING desc: "Indicates that the device has started processing this event." - - name: EXECUTION_INFO_SUBMITTED + - name: SUBMITTED desc: "Indicates that the event has been submitted by the host to the device." - - name: EXECUTION_INFO_QUEUED + - name: QUEUED desc: "Indicates that the event has been queued, this is the initial state of events." --- #-------------------------------------------------------------------------- type: fptr_typedef @@ -351,6 +351,7 @@ decl: static ordinal: "0" details: - "The registered callback function will be called when the execution status of command associated with event changes to an execution status equal to or past the status specified by command_exec_status." + - "`execStatus` must not be `UR_EXECUTION_INFO_QUEUED` as this is the initial state of all events." - "The application may call this function from simultaneous threads for the same context." - "The implementation of this function should be thread-safe." params: @@ -366,3 +367,6 @@ params: - type: void* name: pUserData desc: "[in][out][optional] pointer to data to be passed to callback." +returns: + - $X_RESULT_ERROR_UNSUPPORTED_ENUMERATION: + - "`execStatus == UR_EXECUTION_INFO_QUEUED`" diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 572922693d..fba0beedbd 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -9649,20 +9649,20 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_execution_info_t value) { switch (value) { - case UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE: - os << "UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE"; + case UR_EXECUTION_INFO_COMPLETE: + os << "UR_EXECUTION_INFO_COMPLETE"; break; - case UR_EXECUTION_INFO_EXECUTION_INFO_RUNNING: - os << "UR_EXECUTION_INFO_EXECUTION_INFO_RUNNING"; + case UR_EXECUTION_INFO_RUNNING: + os << "UR_EXECUTION_INFO_RUNNING"; break; - case UR_EXECUTION_INFO_EXECUTION_INFO_SUBMITTED: - os << "UR_EXECUTION_INFO_EXECUTION_INFO_SUBMITTED"; + case UR_EXECUTION_INFO_SUBMITTED: + os << "UR_EXECUTION_INFO_SUBMITTED"; break; - case UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED: - os << "UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED"; + case UR_EXECUTION_INFO_QUEUED: + os << "UR_EXECUTION_INFO_QUEUED"; break; default: os << "unknown enumerator"; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 43b6902832..f6ae024c27 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -3888,9 +3888,13 @@ __urdlllocal ur_result_t UR_APICALL urEventSetCallback( return UR_RESULT_ERROR_INVALID_NULL_POINTER; } - if (UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED < execStatus) { + if (UR_EXECUTION_INFO_QUEUED < execStatus) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } + + if (execStatus == UR_EXECUTION_INFO_QUEUED) { + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; + } } ur_result_t result = diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index d86d9606fa..b66833feff 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -4550,6 +4550,8 @@ ur_result_t UR_APICALL urEventCreateWithNativeHandle( /// - The registered callback function will be called when the execution /// status of command associated with event changes to an execution status /// equal to or past the status specified by command_exec_status. +/// - `execStatus` must not be `UR_EXECUTION_INFO_QUEUED` as this is the +/// initial state of all events. /// - The application may call this function from simultaneous threads for /// the same context. /// - The implementation of this function should be thread-safe. @@ -4562,9 +4564,11 @@ ur_result_t UR_APICALL urEventCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hEvent` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED < execStatus` +/// + `::UR_EXECUTION_INFO_QUEUED < execStatus` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pfnNotify` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + `execStatus == UR_EXECUTION_INFO_QUEUED` ur_result_t UR_APICALL urEventSetCallback( ur_event_handle_t hEvent, ///< [in] handle of the event object ur_execution_info_t execStatus, ///< [in] execution status of the event diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 6f3d0c74a7..cfb6e87d63 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -3841,6 +3841,8 @@ ur_result_t UR_APICALL urEventCreateWithNativeHandle( /// - The registered callback function will be called when the execution /// status of command associated with event changes to an execution status /// equal to or past the status specified by command_exec_status. +/// - `execStatus` must not be `UR_EXECUTION_INFO_QUEUED` as this is the +/// initial state of all events. /// - The application may call this function from simultaneous threads for /// the same context. /// - The implementation of this function should be thread-safe. @@ -3853,9 +3855,11 @@ ur_result_t UR_APICALL urEventCreateWithNativeHandle( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hEvent` /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION -/// + `::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED < execStatus` +/// + `::UR_EXECUTION_INFO_QUEUED < execStatus` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// + `NULL == pfnNotify` +/// - ::UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION +/// + `execStatus == UR_EXECUTION_INFO_QUEUED` ur_result_t UR_APICALL urEventSetCallback( ur_event_handle_t hEvent, ///< [in] handle of the event object ur_execution_info_t execStatus, ///< [in] execution status of the event diff --git a/test/conformance/event/urEventSetCallback.cpp b/test/conformance/event/urEventSetCallback.cpp index a822b1825b..ac6f988e71 100644 --- a/test/conformance/event/urEventSetCallback.cpp +++ b/test/conformance/event/urEventSetCallback.cpp @@ -25,7 +25,7 @@ TEST_P(urEventSetCallbackTest, Success) { bool didRun = false; ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE, + event, ur_execution_info_t::UR_EXECUTION_INFO_COMPLETE, Callback::callback, &didRun)); ASSERT_SUCCESS(urEventWait(1, &event)); @@ -56,13 +56,13 @@ TEST_P(urEventSetCallbackTest, ValidateParameters) { CallbackParameters parameters{}; ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE, + event, ur_execution_info_t::UR_EXECUTION_INFO_COMPLETE, Callback::callback, ¶meters)); ASSERT_SUCCESS(urEventWait(1, &event)); ASSERT_SUCCESS(urEventRelease(event)); ASSERT_EQ(event, parameters.event); - ASSERT_EQ(ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE, + ASSERT_EQ(ur_execution_info_t::UR_EXECUTION_INFO_COMPLETE, parameters.execStatus); } @@ -72,7 +72,6 @@ TEST_P(urEventSetCallbackTest, ValidateParameters) { TEST_P(urEventSetCallbackTest, AllStates) { struct CallbackStatus { - bool queued = false; bool submitted = false; bool running = false; bool complete = false; @@ -84,22 +83,15 @@ TEST_P(urEventSetCallbackTest, AllStates) { auto status = reinterpret_cast(pUserData); switch (execStatus) { - case ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED: { - status->queued = true; - break; - } - case ur_execution_info_t:: - UR_EXECUTION_INFO_EXECUTION_INFO_SUBMITTED: { + case ur_execution_info_t::UR_EXECUTION_INFO_SUBMITTED: { status->submitted = true; break; } - case ur_execution_info_t:: - UR_EXECUTION_INFO_EXECUTION_INFO_RUNNING: { + case ur_execution_info_t::UR_EXECUTION_INFO_RUNNING: { status->running = true; break; } - case ur_execution_info_t:: - UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE: { + case ur_execution_info_t::UR_EXECUTION_INFO_COMPLETE: { status->complete = true; break; } @@ -113,22 +105,18 @@ TEST_P(urEventSetCallbackTest, AllStates) { CallbackStatus status{}; ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED, + event, ur_execution_info_t::UR_EXECUTION_INFO_SUBMITTED, Callback::callback, &status)); ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_SUBMITTED, + event, ur_execution_info_t::UR_EXECUTION_INFO_RUNNING, Callback::callback, &status)); ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_RUNNING, - Callback::callback, &status)); - ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE, + event, ur_execution_info_t::UR_EXECUTION_INFO_COMPLETE, Callback::callback, &status)); ASSERT_SUCCESS(urEventWait(1, &event)); ASSERT_SUCCESS(urEventRelease(event)); - ASSERT_TRUE(status.queued); ASSERT_TRUE(status.submitted); ASSERT_TRUE(status.running); ASSERT_TRUE(status.complete); @@ -155,7 +143,7 @@ TEST_P(urEventSetCallbackTest, EventAlreadyCompleted) { bool didRun = false; ASSERT_SUCCESS(urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE, + event, ur_execution_info_t::UR_EXECUTION_INFO_COMPLETE, Callback::callback, &didRun)); ASSERT_SUCCESS(urEventRelease(event)); @@ -170,19 +158,16 @@ using urEventSetCallbackNegativeTest = uur::event::urEventTest; void emptyCallback(ur_event_handle_t, ur_execution_info_t, void *) {} TEST_P(urEventSetCallbackNegativeTest, InvalidNullHandleEvent) { - ASSERT_EQ_RESULT( - urEventSetCallback( - nullptr, - ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED, - emptyCallback, nullptr), - UR_RESULT_ERROR_INVALID_NULL_HANDLE); + ASSERT_EQ_RESULT(urEventSetCallback( + nullptr, ur_execution_info_t::UR_EXECUTION_INFO_QUEUED, + emptyCallback, nullptr), + UR_RESULT_ERROR_INVALID_NULL_HANDLE); } TEST_P(urEventSetCallbackNegativeTest, InvalidNullPointerCallback) { ASSERT_EQ_RESULT( - urEventSetCallback( - event, ur_execution_info_t::UR_EXECUTION_INFO_EXECUTION_INFO_QUEUED, - nullptr, nullptr), + urEventSetCallback(event, ur_execution_info_t::UR_EXECUTION_INFO_QUEUED, + nullptr, nullptr), UR_RESULT_ERROR_INVALID_NULL_POINTER); } diff --git a/test/conformance/queue/urQueueFinish.cpp b/test/conformance/queue/urQueueFinish.cpp index fd557c21b2..069f8b5d67 100644 --- a/test/conformance/queue/urQueueFinish.cpp +++ b/test/conformance/queue/urQueueFinish.cpp @@ -25,7 +25,7 @@ TEST_P(urQueueFinishTest, Success) { ur_event_status_t exec_status; ASSERT_SUCCESS(urEventGetInfo(event, UR_EVENT_INFO_COMMAND_EXECUTION_STATUS, sizeof(exec_status), &exec_status, nullptr)); - ASSERT_EQ(exec_status, UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE); + ASSERT_EQ(exec_status, UR_EXECUTION_INFO_COMPLETE); } TEST_P(urQueueFinishTest, InvalidNullHandleQueue) { From 7a9e83c7e66b0497d28369f4c5ad3276ff724090 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Wed, 4 Oct 2023 13:54:01 +0200 Subject: [PATCH 057/145] Fix usmPoolManager test coverity defect --- test/usm/usmPoolManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/usm/usmPoolManager.cpp b/test/usm/usmPoolManager.cpp index 4365a5ce7b..fe07d5ebe8 100644 --- a/test/usm/usmPoolManager.cpp +++ b/test/usm/usmPoolManager.cpp @@ -58,7 +58,7 @@ struct urUsmPoolManagerTest : public uur::urContextTest { UUR_RETURN_ON_FATAL_FAILURE(urContextTest::SetUp()); auto [ret, descs] = usm::pool_descriptor::create(nullptr, context); ASSERT_EQ(ret, UR_RESULT_SUCCESS); - poolDescriptors = descs; + poolDescriptors = std::move(descs); } std::vector poolDescriptors; From c282ba0d101cca41ecdbad992bf6f643e7e9a2f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio?= Date: Thu, 5 Oct 2023 15:52:35 +0100 Subject: [PATCH 058/145] Add validation layer support for nullptr events (#929) This commit adds checks in the validation layer for the case where the event wait list parameter in urEnqueue entrypoints contains a nullptr event. --- scripts/templates/helper.py | 11 + scripts/templates/valddi.cpp.mako | 10 + source/loader/layers/validation/ur_valddi.cpp | 232 ++++++++++++++++++ .../enqueue/urEnqueueEventsWait.cpp | 4 + .../urEnqueueEventsWaitWithBarrier.cpp | 5 + .../enqueue/urEnqueueKernelLaunch.cpp | 6 + .../enqueue/urEnqueueMemBufferCopy.cpp | 5 + .../enqueue/urEnqueueMemBufferCopyRect.cpp | 7 + .../enqueue/urEnqueueMemBufferFill.cpp | 6 + .../enqueue/urEnqueueMemBufferMap.cpp | 6 + .../enqueue/urEnqueueMemBufferRead.cpp | 6 + .../enqueue/urEnqueueMemBufferReadRect.cpp | 7 + .../enqueue/urEnqueueMemBufferWrite.cpp | 6 + .../enqueue/urEnqueueMemBufferWriteRect.cpp | 7 + .../enqueue/urEnqueueMemImageCopy.cpp | 6 + .../enqueue/urEnqueueMemImageRead.cpp | 6 + .../enqueue/urEnqueueMemImageWrite.cpp | 6 + .../conformance/enqueue/urEnqueueMemUnmap.cpp | 5 + .../enqueue/urEnqueueReadHostPipe.cpp | 6 + test/conformance/enqueue/urEnqueueUSMFill.cpp | 5 + .../enqueue/urEnqueueUSMFill2D.cpp | 6 + .../enqueue/urEnqueueUSMMemcpy.cpp | 5 + .../enqueue/urEnqueueUSMMemcpy2D.cpp | 5 + .../enqueue/urEnqueueUSMPrefetch.cpp | 6 + .../enqueue/urEnqueueWriteHostPipe.cpp | 6 + 25 files changed, 380 insertions(+) diff --git a/scripts/templates/helper.py b/scripts/templates/helper.py index e6e3a8569e..4fbb2ca47b 100644 --- a/scripts/templates/helper.py +++ b/scripts/templates/helper.py @@ -1328,3 +1328,14 @@ def get_create_retain_release_functions(specs, namespace, tags): ) return {"create": create_funcs, "retain": retain_funcs, "release": release_funcs} + + +def get_event_wait_list_functions(specs, namespace, tags): + funcs = [] + for s in specs: + for obj in s['objects']: + if re.match(r"function", obj['type']): + if any(x['name'] == 'phEventWaitList' for x in obj['params']) and any( + x['name'] == 'numEventsInWaitList' for x in obj['params']): + funcs.append(make_func_name(namespace, tags, obj)) + return funcs diff --git a/scripts/templates/valddi.cpp.mako b/scripts/templates/valddi.cpp.mako index e778d01833..c99328727d 100644 --- a/scripts/templates/valddi.cpp.mako +++ b/scripts/templates/valddi.cpp.mako @@ -60,6 +60,16 @@ namespace ur_validation_layer %endfor %endfor + %if func_name in th.get_event_wait_list_functions(specs, n, tags): + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } + %endif + } ${x}_result_t result = ${th.make_pfn_name(n, tags, obj)}( ${", ".join(th.make_param_lines(n, tags, obj, format=["name"]))} ); diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index f6ae024c27..b4298dacf3 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -3964,6 +3964,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueKernelLaunch( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnKernelLaunch( @@ -4006,6 +4014,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWait( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4048,6 +4064,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnEventsWaitWithBarrier(hQueue, numEventsInWaitList, @@ -4101,6 +4125,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4157,6 +4189,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4263,6 +4303,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnMemBufferReadRect( @@ -4374,6 +4422,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnMemBufferWriteRect( @@ -4429,6 +4485,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4528,6 +4592,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnMemBufferCopyRect( @@ -4603,6 +4675,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( if (offset % patternSize != 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4666,6 +4746,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( if (region.width == 0 || region.height == 0 || region.depth == 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnMemImageRead( @@ -4730,6 +4818,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( if (region.width == 0 || region.height == 0 || region.depth == 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnMemImageWrite( @@ -4794,6 +4890,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( if (region.width == 0 || region.height == 0 || region.depth == 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4854,6 +4958,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnMemBufferMap(hQueue, hBuffer, blockingMap, mapFlags, @@ -4906,6 +5018,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -4979,6 +5099,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5036,6 +5164,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5092,6 +5228,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5225,6 +5369,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5303,6 +5455,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5366,6 +5526,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnDeviceGlobalVariableWrite( @@ -5429,6 +5597,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnDeviceGlobalVariableRead( @@ -5495,6 +5671,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueReadHostPipe( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5561,6 +5745,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueWriteHostPipe( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = @@ -5982,6 +6174,14 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesImageCopyExp( if (pImageDesc && UR_MEM_TYPE_IMAGE1D_BUFFER < pImageDesc->type) { return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnImageCopyExp( @@ -6348,6 +6548,14 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesWaitExternalSemaphoreExp( if (NULL == hSemaphore) { return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnWaitExternalSemaphoreExp( @@ -6388,6 +6596,14 @@ __urdlllocal ur_result_t UR_APICALL urBindlessImagesSignalExternalSemaphoreExp( if (NULL == hSemaphore) { return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnSignalExternalSemaphoreExp( @@ -7252,6 +7468,14 @@ __urdlllocal ur_result_t UR_APICALL urCommandBufferEnqueueExp( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnEnqueueExp( @@ -7322,6 +7546,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueCooperativeKernelLaunchExp( if (phEventWaitList != NULL && numEventsInWaitList == 0) { return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + + if (phEventWaitList != NULL && numEventsInWaitList > 0) { + for (uint32_t i = 0; i < numEventsInWaitList; ++i) { + if (phEventWaitList[i] == NULL) { + return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; + } + } + } } ur_result_t result = pfnCooperativeKernelLaunchExp( diff --git a/test/conformance/enqueue/urEnqueueEventsWait.cpp b/test/conformance/enqueue/urEnqueueEventsWait.cpp index a80c884e87..0b7db213dc 100644 --- a/test/conformance/enqueue/urEnqueueEventsWait.cpp +++ b/test/conformance/enqueue/urEnqueueEventsWait.cpp @@ -80,4 +80,8 @@ TEST_P(urEnqueueEventsWaitTest, InvalidNullPtrEventWaitList) { ASSERT_EQ_RESULT(urEnqueueEventsWait(queue1, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueEventsWait(queue1, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueEventsWaitWithBarrier.cpp b/test/conformance/enqueue/urEnqueueEventsWaitWithBarrier.cpp index ca465e937e..a107ed7b9c 100644 --- a/test/conformance/enqueue/urEnqueueEventsWaitWithBarrier.cpp +++ b/test/conformance/enqueue/urEnqueueEventsWaitWithBarrier.cpp @@ -89,4 +89,9 @@ TEST_P(urEnqueueEventsWaitWithBarrierTest, InvalidNullPtrEventWaitList) { ASSERT_EQ_RESULT( urEnqueueEventsWaitWithBarrier(queue1, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT( + urEnqueueEventsWaitWithBarrier(queue1, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp index 0bca070da9..a75c8a3706 100644 --- a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp +++ b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp @@ -56,6 +56,12 @@ TEST_P(urEnqueueKernelLaunchTest, InvalidNullPtrEventWaitList) { &global_offset, &global_size, nullptr, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueKernelLaunch(queue, kernel, n_dimensions, + &global_offset, &global_size, + nullptr, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueKernelLaunchTest, InvalidWorkDimension) { diff --git a/test/conformance/enqueue/urEnqueueMemBufferCopy.cpp b/test/conformance/enqueue/urEnqueueMemBufferCopy.cpp index 3eb2308702..f226e7597a 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferCopy.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferCopy.cpp @@ -74,6 +74,11 @@ TEST_P(urEnqueueMemBufferCopyTest, InvalidNullPtrEventWaitList) { ASSERT_EQ_RESULT(urEnqueueMemBufferCopy(queue, src_buffer, dst_buffer, 0, 0, size, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemBufferCopy(queue, src_buffer, dst_buffer, 0, 0, + size, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemBufferCopyTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemBufferCopyRect.cpp b/test/conformance/enqueue/urEnqueueMemBufferCopyRect.cpp index f330503211..873c4953a7 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferCopyRect.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferCopyRect.cpp @@ -219,6 +219,13 @@ TEST_P(urEnqueueMemBufferCopyRectTest, InvalidNullPtrEventWaitList) { src_region, size, size, size, size, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemBufferCopyRect(queue, src_buffer, dst_buffer, + src_origin, dst_origin, + src_region, size, size, size, + size, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } using urEnqueueMemBufferCopyRectMultiDeviceTest = diff --git a/test/conformance/enqueue/urEnqueueMemBufferFill.cpp b/test/conformance/enqueue/urEnqueueMemBufferFill.cpp index cbeae5e85c..d1002960fb 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferFill.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferFill.cpp @@ -183,6 +183,12 @@ TEST_P(urEnqueueMemBufferFillNegativeTest, InvalidNullPtrEventWaitList) { sizeof(uint32_t), 0, size, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemBufferFill(queue, buffer, &pattern, + sizeof(uint32_t), 0, size, 1, + &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemBufferFillNegativeTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemBufferMap.cpp b/test/conformance/enqueue/urEnqueueMemBufferMap.cpp index 5ed576d6f3..fc44360c22 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferMap.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferMap.cpp @@ -187,6 +187,12 @@ TEST_P(urEnqueueMemBufferMapTest, InvalidNullPtrEventWaitList) { 0, size, 0, &validEvent, nullptr, &map), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemBufferMap(queue, buffer, true, + UR_MAP_FLAG_READ | UR_MAP_FLAG_WRITE, + 0, size, 1, &inv_evt, nullptr, &map), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemBufferMapTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemBufferRead.cpp b/test/conformance/enqueue/urEnqueueMemBufferRead.cpp index 0192333783..6410d6feed 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferRead.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferRead.cpp @@ -49,6 +49,12 @@ TEST_P(urEnqueueMemBufferReadTest, InvalidNullPtrEventWaitList) { output.data(), 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemBufferRead(queue, buffer, true, 0, size, + output.data(), 1, &inv_evt, + nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemBufferReadTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp b/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp index ae0cc05332..28e373104c 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp @@ -176,6 +176,13 @@ TEST_P(urEnqueueMemBufferReadRectTest, InvalidNullPtrEventWaitList) { host_offset, region, size, size, size, size, dst.data(), 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT( + urEnqueueMemBufferReadRect(queue, buffer, true, buffer_offset, + host_offset, region, size, size, size, size, + dst.data(), 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } using urEnqueueMemBufferReadRectMultiDeviceTest = diff --git a/test/conformance/enqueue/urEnqueueMemBufferWrite.cpp b/test/conformance/enqueue/urEnqueueMemBufferWrite.cpp index 913d583058..aea6b8face 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferWrite.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferWrite.cpp @@ -61,6 +61,12 @@ TEST_P(urEnqueueMemBufferWriteTest, InvalidNullPtrEventWaitList) { input.data(), 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemBufferWrite(queue, buffer, true, 0, size, + input.data(), 1, &inv_evt, + nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemBufferWriteTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemBufferWriteRect.cpp b/test/conformance/enqueue/urEnqueueMemBufferWriteRect.cpp index e41991e727..d3c7e5c7a3 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferWriteRect.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferWriteRect.cpp @@ -183,6 +183,13 @@ TEST_P(urEnqueueMemBufferWriteRectTest, InvalidNullPtrEventWaitList) { host_offset, region, size, size, size, size, src.data(), 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT( + urEnqueueMemBufferWriteRect(queue, buffer, true, buffer_offset, + host_offset, region, size, size, size, size, + src.data(), 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemBufferWriteRectTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemImageCopy.cpp b/test/conformance/enqueue/urEnqueueMemImageCopy.cpp index e75ab38976..2e29dab482 100644 --- a/test/conformance/enqueue/urEnqueueMemImageCopy.cpp +++ b/test/conformance/enqueue/urEnqueueMemImageCopy.cpp @@ -233,6 +233,12 @@ TEST_P(urEnqueueMemImageCopyTest, InvalidNullPtrEventWaitList) { {0, 0, 0}, size, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemImageCopy(queue, srcImage, dstImage, {0, 0, 0}, + {0, 0, 0}, size, 1, &inv_evt, + nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemImageCopyTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueMemImageRead.cpp b/test/conformance/enqueue/urEnqueueMemImageRead.cpp index d40625c3e1..daebe0865d 100644 --- a/test/conformance/enqueue/urEnqueueMemImageRead.cpp +++ b/test/conformance/enqueue/urEnqueueMemImageRead.cpp @@ -69,6 +69,12 @@ TEST_P(urEnqueueMemImageReadTest, InvalidNullPtrEventWaitList) { region1D, 0, 0, output.data(), 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemImageRead(queue, image1D, true, origin, + region1D, 0, 0, output.data(), 1, + &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemImageReadTest, InvalidOrigin1D) { diff --git a/test/conformance/enqueue/urEnqueueMemImageWrite.cpp b/test/conformance/enqueue/urEnqueueMemImageWrite.cpp index 7f7968bdff..76b5f0b4dd 100644 --- a/test/conformance/enqueue/urEnqueueMemImageWrite.cpp +++ b/test/conformance/enqueue/urEnqueueMemImageWrite.cpp @@ -66,6 +66,12 @@ TEST_P(urEnqueueMemImageWriteTest, InvalidNullPtrEventWaitList) { region1D, 0, 0, input.data(), 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueMemImageWrite(queue, image1D, true, origin, + region1D, 0, 0, input.data(), 1, + &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } TEST_P(urEnqueueMemImageWriteTest, InvalidOrigin1D) { diff --git a/test/conformance/enqueue/urEnqueueMemUnmap.cpp b/test/conformance/enqueue/urEnqueueMemUnmap.cpp index a205ded3b9..046d3088d9 100644 --- a/test/conformance/enqueue/urEnqueueMemUnmap.cpp +++ b/test/conformance/enqueue/urEnqueueMemUnmap.cpp @@ -50,4 +50,9 @@ TEST_P(urEnqueueMemUnmapTest, InvalidNullPtrEventWaitList) { ASSERT_EQ_RESULT( urEnqueueMemUnmap(queue, buffer, map, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT( + urEnqueueMemUnmap(queue, buffer, map, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueReadHostPipe.cpp b/test/conformance/enqueue/urEnqueueReadHostPipe.cpp index 93e82b6531..379ee23f9d 100644 --- a/test/conformance/enqueue/urEnqueueReadHostPipe.cpp +++ b/test/conformance/enqueue/urEnqueueReadHostPipe.cpp @@ -76,4 +76,10 @@ TEST_P(urEnqueueReadHostPipeTest, InvalidEventWaitList) { urEnqueueReadHostPipe(queue, program, pipe_symbol, /*blocking*/ true, &buffer, size, 0, &validEvent, nullptr)); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueReadHostPipe(queue, program, pipe_symbol, + /*blocking*/ true, &buffer, size, 1, + &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueUSMFill.cpp b/test/conformance/enqueue/urEnqueueUSMFill.cpp index e595056035..24a6a240fb 100644 --- a/test/conformance/enqueue/urEnqueueUSMFill.cpp +++ b/test/conformance/enqueue/urEnqueueUSMFill.cpp @@ -203,4 +203,9 @@ TEST_P(urEnqueueUSMFillNegativeTest, InvalidEventWaitList) { ASSERT_EQ_RESULT(urEnqueueUSMFill(queue, ptr, pattern_size, pattern.data(), size, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueUSMFill(queue, ptr, pattern_size, pattern.data(), + size, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueUSMFill2D.cpp b/test/conformance/enqueue/urEnqueueUSMFill2D.cpp index 9cd5bc7591..d43a758827 100644 --- a/test/conformance/enqueue/urEnqueueUSMFill2D.cpp +++ b/test/conformance/enqueue/urEnqueueUSMFill2D.cpp @@ -273,4 +273,10 @@ TEST_P(urEnqueueUSMFill2DNegativeTest, InvalidNullPtrEventWaitList) { pattern.data(), width, 1, 0, &validEvent, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueUSMFill2D(queue, ptr, pitch, pattern_size, + pattern.data(), width, 1, 1, &inv_evt, + nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp b/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp index e1af65896c..a2c14a5a92 100644 --- a/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp +++ b/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp @@ -158,6 +158,11 @@ TEST_P(urEnqueueUSMMemcpyTest, InvalidNullPtrEventWaitList) { allocation_size, 0, &memset_event, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueUSMMemcpy(queue, true, device_dst, device_src, + allocation_size, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueUSMMemcpyTest); diff --git a/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp b/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp index e56d2a02c9..d64b499966 100644 --- a/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp +++ b/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp @@ -183,5 +183,10 @@ TEST_P(urEnqueueUSMMemcpy2DNegativeTest, InvalidEventWaitList) { urEnqueueUSMMemcpy2D(queue, true, pDst, pitch, pSrc, pitch, width, height, 0, &event, nullptr)); + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueUSMMemcpy2D(queue, true, pDst, pitch, pSrc, pitch, + width, height, 1, &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + ASSERT_SUCCESS(urEventRelease(event)); } diff --git a/test/conformance/enqueue/urEnqueueUSMPrefetch.cpp b/test/conformance/enqueue/urEnqueueUSMPrefetch.cpp index 70b93a55b7..cd7b087876 100644 --- a/test/conformance/enqueue/urEnqueueUSMPrefetch.cpp +++ b/test/conformance/enqueue/urEnqueueUSMPrefetch.cpp @@ -122,4 +122,10 @@ TEST_P(urEnqueueUSMPrefetchTest, InvalidEventWaitList) { urEnqueueUSMPrefetch(queue, ptr, allocation_size, UR_USM_MIGRATION_FLAG_DEFAULT, 0, &validEvent, nullptr)); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueUSMPrefetch(queue, ptr, allocation_size, + UR_USM_MIGRATION_FLAG_DEFAULT, 1, + &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } diff --git a/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp b/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp index 917a94a672..86e3b99fe3 100644 --- a/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp +++ b/test/conformance/enqueue/urEnqueueWriteHostPipe.cpp @@ -76,4 +76,10 @@ TEST_P(urEnqueueWriteHostPipeTest, InvalidEventWaitList) { urEnqueueWriteHostPipe(queue, program, pipe_symbol, /*blocking*/ true, &buffer, size, 0, &validEvent, nullptr)); + + ur_event_handle_t inv_evt = nullptr; + ASSERT_EQ_RESULT(urEnqueueWriteHostPipe(queue, program, pipe_symbol, + /*blocking*/ true, &buffer, size, 1, + &inv_evt, nullptr), + UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); } From 47314b32b6ab60ee4d8cc9d58cb59d65786af8d5 Mon Sep 17 00:00:00 2001 From: Damian Duy Date: Tue, 3 Oct 2023 12:30:03 +0200 Subject: [PATCH 059/145] [umf] ensure MinBucketSize parameter is a power of two --- source/common/umf_pools/disjoint_pool.cpp | 6 ++++++ source/common/umf_pools/disjoint_pool.hpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/source/common/umf_pools/disjoint_pool.cpp b/source/common/umf_pools/disjoint_pool.cpp index 9a4a2d79b9..dcccb25c3b 100644 --- a/source/common/umf_pools/disjoint_pool.cpp +++ b/source/common/umf_pools/disjoint_pool.cpp @@ -894,6 +894,12 @@ umf_result_t DisjointPool::initialize(umf_memory_provider_handle_t *providers, if (numProviders != 1 || !providers[0]) { return UMF_RESULT_ERROR_INVALID_ARGUMENT; } + // MinBucketSize parameter must be a power of 2 for bucket sizes + // to generate correctly. + if (!parameters.MinBucketSize || + !((parameters.MinBucketSize & (parameters.MinBucketSize - 1)) == 0)) { + return UMF_RESULT_ERROR_INVALID_ARGUMENT; + } impl = std::make_unique(providers[0], parameters); return UMF_RESULT_SUCCESS; diff --git a/source/common/umf_pools/disjoint_pool.hpp b/source/common/umf_pools/disjoint_pool.hpp index a8c9487ef2..f5b67ef3ed 100644 --- a/source/common/umf_pools/disjoint_pool.hpp +++ b/source/common/umf_pools/disjoint_pool.hpp @@ -45,7 +45,8 @@ class DisjointPoolConfig { size_t Capacity = 0; // Holds the minimum bucket size valid for allocation of a memory type. - size_t MinBucketSize = 0; + // This value must be a power of 2. + size_t MinBucketSize = 1; // Holds size of the pool managed by the allocator. size_t CurPoolSize = 0; From 86384297321bb7b0f0aacb5b7f61dc5818b91034 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Fri, 6 Oct 2023 16:49:37 +0100 Subject: [PATCH 060/145] Fix a couple of minor issues in the USM fill and memcpy tests * Release a couple of events * Check the output buffer for Fill2D row first instead of column first * Change size of a pattern to match the size of a fill --- test/conformance/enqueue/urEnqueueUSMFill2D.cpp | 5 +++-- test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/conformance/enqueue/urEnqueueUSMFill2D.cpp b/test/conformance/enqueue/urEnqueueUSMFill2D.cpp index d43a758827..37470d40e2 100644 --- a/test/conformance/enqueue/urEnqueueUSMFill2D.cpp +++ b/test/conformance/enqueue/urEnqueueUSMFill2D.cpp @@ -66,8 +66,8 @@ struct urEnqueueUSMFill2DTestWithParam nullptr, nullptr)); size_t pattern_index = 0; - for (size_t w = 0; w < width; ++w) { - for (size_t h = 0; h < height; ++h) { + for (size_t h = 0; h < height; ++h) { + for (size_t w = 0; w < width; ++w) { uint8_t *host_ptr = host_mem.data(); size_t index = (pitch * h) + w; ASSERT_TRUE((*(host_ptr + index) == pattern[pattern_index])); @@ -279,4 +279,5 @@ TEST_P(urEnqueueUSMFill2DNegativeTest, InvalidNullPtrEventWaitList) { pattern.data(), width, 1, 1, &inv_evt, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + ASSERT_SUCCESS(urEventRelease(validEvent)); } diff --git a/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp b/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp index d64b499966..8eaed4b743 100644 --- a/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp +++ b/test/conformance/enqueue/urEnqueueUSMMemcpy2D.cpp @@ -104,6 +104,7 @@ TEST_P(urEnqueueUSMMemcpy2DTestWithParam, SuccessNonBlocking) { ASSERT_SUCCESS(uur::GetEventInfo( memcpy_event, UR_EVENT_INFO_COMMAND_EXECUTION_STATUS, event_status)); ASSERT_EQ(event_status, UR_EVENT_STATUS_COMPLETE); + ASSERT_SUCCESS(urEventRelease(memcpy_event)); ASSERT_NO_FATAL_FAILURE(verifyMemcpySucceeded()); } @@ -169,7 +170,7 @@ TEST_P(urEnqueueUSMMemcpy2DNegativeTest, InvalidSize) { TEST_P(urEnqueueUSMMemcpy2DNegativeTest, InvalidEventWaitList) { // enqueue something to get an event ur_event_handle_t event = nullptr; - int fill_pattern = 14; + uint8_t fill_pattern = 14; ASSERT_SUCCESS(urEnqueueUSMFill2D(queue, pDst, pitch, sizeof(fill_pattern), &fill_pattern, width, height, 0, nullptr, &event)); From 74a5104b51bdbc13c3ba068ceb3ac2afdb5e8854 Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Mon, 9 Oct 2023 17:00:47 +0100 Subject: [PATCH 061/145] Release a few more events --- test/conformance/enqueue/urEnqueueMemBufferFill.cpp | 1 + test/conformance/enqueue/urEnqueueUSMFill.cpp | 1 + test/conformance/enqueue/urEnqueueUSMMemcpy.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/test/conformance/enqueue/urEnqueueMemBufferFill.cpp b/test/conformance/enqueue/urEnqueueMemBufferFill.cpp index d1002960fb..59e7e445c9 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferFill.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferFill.cpp @@ -189,6 +189,7 @@ TEST_P(urEnqueueMemBufferFillNegativeTest, InvalidNullPtrEventWaitList) { sizeof(uint32_t), 0, size, 1, &inv_evt, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + ASSERT_SUCCESS(urEventRelease(validEvent)); } TEST_P(urEnqueueMemBufferFillNegativeTest, InvalidSize) { diff --git a/test/conformance/enqueue/urEnqueueUSMFill.cpp b/test/conformance/enqueue/urEnqueueUSMFill.cpp index 24a6a240fb..815c5bd2a5 100644 --- a/test/conformance/enqueue/urEnqueueUSMFill.cpp +++ b/test/conformance/enqueue/urEnqueueUSMFill.cpp @@ -208,4 +208,5 @@ TEST_P(urEnqueueUSMFillNegativeTest, InvalidEventWaitList) { ASSERT_EQ_RESULT(urEnqueueUSMFill(queue, ptr, pattern_size, pattern.data(), size, 1, &inv_evt, nullptr), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + ASSERT_SUCCESS(urEventRelease(validEvent)); } diff --git a/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp b/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp index a2c14a5a92..6cd16546e9 100644 --- a/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp +++ b/test/conformance/enqueue/urEnqueueUSMMemcpy.cpp @@ -115,6 +115,7 @@ TEST_P(urEnqueueUSMMemcpyTest, NonBlocking) { allocation_size, 0, nullptr, &memcpy_event)); ASSERT_SUCCESS(urEventWait(1, &memcpy_event)); + ASSERT_SUCCESS(urEventRelease(memcpy_event)); ASSERT_NO_FATAL_FAILURE(verifyData()); } From 4f5dc2e8392b126c8e631631edf5ec24a930cdde Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Wed, 11 Oct 2023 11:46:31 +0100 Subject: [PATCH 062/145] Add testing for memory management across multi-device contexts --- .../enqueue/urEnqueueKernelLaunch.cpp | 46 +++++++ .../enqueue/urEnqueueMemBufferReadRect.cpp | 3 +- .../enqueue/urEnqueueMemImageCopy.cpp | 60 +++++++++ .../enqueue/urEnqueueMemImageRead.cpp | 36 ++++++ .../testing/include/uur/fixtures.h | 122 ++++++++++++++++++ 5 files changed, 266 insertions(+), 1 deletion(-) diff --git a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp index a75c8a3706..d9cb79e372 100644 --- a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp +++ b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp @@ -216,3 +216,49 @@ TEST_P(urEnqueueKernelLaunchWithVirtualMemory, Success) { ASSERT_EQ(fill_val, data.at(i)); } } + +struct urEnqueueKernelLaunchMultiDeviceTest : public urEnqueueKernelLaunchTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urEnqueueKernelLaunchTest::SetUp()); + queues.reserve(uur::DevicesEnvironment::instance->devices.size()); + for (const auto &device : uur::DevicesEnvironment::instance->devices) { + ur_queue_handle_t queue = nullptr; + ASSERT_SUCCESS(urQueueCreate(this->context, device, 0, &queue)); + queues.push_back(queue); + } + } + + void TearDown() override { + for (const auto &queue : queues) { + EXPECT_SUCCESS(urQueueRelease(queue)); + } + UUR_RETURN_ON_FATAL_FAILURE(urEnqueueKernelLaunchTest::TearDown()); + } + + std::vector queues; +}; +UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchMultiDeviceTest); + +TEST_P(urEnqueueKernelLaunchMultiDeviceTest, KernelLaunchReadDifferentQueues) { + ur_mem_handle_t buffer = nullptr; + AddBuffer1DArg(sizeof(val) * global_size, &buffer); + AddPodArg(val); + ASSERT_SUCCESS(urEnqueueKernelLaunch(queues[0], kernel, n_dimensions, + &global_offset, &global_size, nullptr, + 0, nullptr, nullptr)); + + // Wait for the queue to finish executing. + EXPECT_SUCCESS(urEnqueueEventsWait(queues[0], 0, nullptr, nullptr)); + + // Then the remaining queues do blocking reads from the buffer. Since the + // queues target different devices this checks that any devices memory has + // been synchronized. + for (unsigned i = 1; i < queues.size(); ++i) { + const auto queue = queues[i]; + uint32_t output = 0; + ASSERT_SUCCESS(urEnqueueMemBufferRead(queue, buffer, true, 0, + sizeof(output), &output, 0, + nullptr, nullptr)); + ASSERT_EQ(val, output) << "Result on queue " << i << " did not match!"; + } +} diff --git a/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp b/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp index 28e373104c..7068985dfb 100644 --- a/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp +++ b/test/conformance/enqueue/urEnqueueMemBufferReadRect.cpp @@ -188,7 +188,8 @@ TEST_P(urEnqueueMemBufferReadRectTest, InvalidNullPtrEventWaitList) { using urEnqueueMemBufferReadRectMultiDeviceTest = uur::urMultiDeviceMemBufferQueueTest; -TEST_F(urEnqueueMemBufferReadRectMultiDeviceTest, WriteReadDifferentQueues) { +TEST_F(urEnqueueMemBufferReadRectMultiDeviceTest, + WriteRectReadDifferentQueues) { // First queue does a blocking write of 42 into the buffer. // Then a rectangular write the buffer as 1024x1x1 1D. std::vector input(count, 42); diff --git a/test/conformance/enqueue/urEnqueueMemImageCopy.cpp b/test/conformance/enqueue/urEnqueueMemImageCopy.cpp index 2e29dab482..a22b4baa37 100644 --- a/test/conformance/enqueue/urEnqueueMemImageCopy.cpp +++ b/test/conformance/enqueue/urEnqueueMemImageCopy.cpp @@ -251,3 +251,63 @@ TEST_P(urEnqueueMemImageCopyTest, InvalidSize) { {1, 0, 0}, size, 0, nullptr, nullptr)); } + +using urEnqueueMemImageCopyMultiDeviceTest = + uur::urMultiDeviceMemImageWriteTest; + +TEST_F(urEnqueueMemImageCopyMultiDeviceTest, CopyReadDifferentQueues) { + ur_mem_handle_t dstImage1D = nullptr; + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, &format, + &desc1D, nullptr, &dstImage1D)); + ASSERT_SUCCESS(urEnqueueMemImageCopy(queues[0], image1D, dstImage1D, origin, + origin, region1D, 0, nullptr, + nullptr)); + + ur_mem_handle_t dstImage2D = nullptr; + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, &format, + &desc2D, nullptr, &dstImage2D)); + ASSERT_SUCCESS(urEnqueueMemImageCopy(queues[0], image2D, dstImage2D, origin, + origin, region2D, 0, nullptr, + nullptr)); + + ur_mem_handle_t dstImage3D = nullptr; + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, &format, + &desc3D, nullptr, &dstImage3D)); + ASSERT_SUCCESS(urEnqueueMemImageCopy(queues[0], image3D, dstImage3D, origin, + origin, region3D, 0, nullptr, + nullptr)); + + // Wait for the queue to finish executing. + EXPECT_SUCCESS(urEnqueueEventsWait(queues[0], 0, nullptr, nullptr)); + + // The remaining queues do blocking reads from the image1D/2D/3D. Since the + // queues target different devices this checks that any devices memory has + // been synchronized. + for (unsigned i = 1; i < queues.size(); ++i) { + const auto queue = queues[i]; + + std::vector output1D(width * 4, 42); + ASSERT_SUCCESS(urEnqueueMemImageRead(queue, image1D, true, origin, + region1D, 0, 0, output1D.data(), 0, + nullptr, nullptr)); + + std::vector output2D(width * height * 4, 42); + ASSERT_SUCCESS(urEnqueueMemImageRead(queue, image2D, true, origin, + region2D, 0, 0, output2D.data(), 0, + nullptr, nullptr)); + + std::vector output3D(width * height * depth * 4, 42); + ASSERT_SUCCESS(urEnqueueMemImageRead(queue, image3D, true, origin, + region3D, 0, 0, output3D.data(), 0, + nullptr, nullptr)); + + ASSERT_EQ(input1D, output1D) + << "Result on queue " << i << " for 1D image did not match!"; + + ASSERT_EQ(input2D, output2D) + << "Result on queue " << i << " for 2D image did not match!"; + + ASSERT_EQ(input3D, output3D) + << "Result on queue " << i << " for 3D image did not match!"; + } +} diff --git a/test/conformance/enqueue/urEnqueueMemImageRead.cpp b/test/conformance/enqueue/urEnqueueMemImageRead.cpp index daebe0865d..d4cf322958 100644 --- a/test/conformance/enqueue/urEnqueueMemImageRead.cpp +++ b/test/conformance/enqueue/urEnqueueMemImageRead.cpp @@ -130,3 +130,39 @@ TEST_P(urEnqueueMemImageReadTest, InvalidRegion3D) { bad_region, 0, 0, output.data(), 0, nullptr, nullptr)); } + +using urEnqueueMemImageReadMultiDeviceTest = + uur::urMultiDeviceMemImageWriteTest; + +TEST_F(urEnqueueMemImageReadMultiDeviceTest, WriteReadDifferentQueues) { + // The remaining queues do blocking reads from the image1D/2D/3D. Since the + // queues target different devices this checks that any devices memory has + // been synchronized. + for (unsigned i = 1; i < queues.size(); ++i) { + const auto queue = queues[i]; + + std::vector output1D(width * 4, 42); + ASSERT_SUCCESS(urEnqueueMemImageRead(queue, image1D, true, origin, + region1D, 0, 0, output1D.data(), 0, + nullptr, nullptr)); + + std::vector output2D(width * height * 4, 42); + ASSERT_SUCCESS(urEnqueueMemImageRead(queue, image2D, true, origin, + region2D, 0, 0, output2D.data(), 0, + nullptr, nullptr)); + + std::vector output3D(width * height * depth * 4, 42); + ASSERT_SUCCESS(urEnqueueMemImageRead(queue, image3D, true, origin, + region3D, 0, 0, output3D.data(), 0, + nullptr, nullptr)); + + ASSERT_EQ(input1D, output1D) + << "Result on queue " << i << " for 1D image did not match!"; + + ASSERT_EQ(input2D, output2D) + << "Result on queue " << i << " for 2D image did not match!"; + + ASSERT_EQ(input3D, output3D) + << "Result on queue " << i << " for 3D image did not match!"; + } +} diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index 3ae09924b0..46b6c24ad6 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -601,6 +601,128 @@ struct urMemImageQueueTest : urQueueTest { 0}; // num samples }; +struct urMultiDeviceMemImageTest : urMultiDeviceContextTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceContextTest::SetUp()); + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, + &format, &desc1D, nullptr, &image1D)); + + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, + &format, &desc2D, nullptr, &image2D)); + + ASSERT_SUCCESS(urMemImageCreate(context, UR_MEM_FLAG_READ_WRITE, + &format, &desc3D, nullptr, &image3D)); + } + + void TearDown() override { + if (image1D) { + EXPECT_SUCCESS(urMemRelease(image1D)); + } + if (image2D) { + EXPECT_SUCCESS(urMemRelease(image2D)); + } + if (image3D) { + EXPECT_SUCCESS(urMemRelease(image3D)); + } + UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceContextTest::TearDown()); + } + + const size_t width = 1024; + const size_t height = 8; + const size_t depth = 2; + ur_mem_handle_t image1D = nullptr; + ur_mem_handle_t image2D = nullptr; + ur_mem_handle_t image3D = nullptr; + ur_rect_region_t region1D{width, 1, 1}; + ur_rect_region_t region2D{width, height, 1}; + ur_rect_region_t region3D{width, height, depth}; + ur_rect_offset_t origin{0, 0, 0}; + ur_image_format_t format = {UR_IMAGE_CHANNEL_ORDER_RGBA, + UR_IMAGE_CHANNEL_TYPE_FLOAT}; + ur_image_desc_t desc1D = {UR_STRUCTURE_TYPE_IMAGE_DESC, // stype + nullptr, // pNext + UR_MEM_TYPE_IMAGE1D, // mem object type + width, // image width + 1, // image height + 1, // image depth + 1, // array size + 0, // row pitch + 0, // slice pitch + 0, // mip levels + 0}; // num samples + + ur_image_desc_t desc2D = {UR_STRUCTURE_TYPE_IMAGE_DESC, // stype + nullptr, // pNext + UR_MEM_TYPE_IMAGE2D, // mem object type + width, // image width + height, // image height + 1, // image depth + 1, // array size + 0, // row pitch + 0, // slice pitch + 0, // mip levels + 0}; // num samples + + ur_image_desc_t desc3D = {UR_STRUCTURE_TYPE_IMAGE_DESC, // stype + nullptr, // pNext + UR_MEM_TYPE_IMAGE3D, // mem object type + width, // image width + height, // image height + depth, // image depth + 1, // array size + 0, // row pitch + 0, // slice pitch + 0, // mip levels + 0}; // num samples +}; + +struct urMultiDeviceMemImageQueueTest : urMultiDeviceMemImageTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceMemImageTest::SetUp()); + queues.reserve(DevicesEnvironment::instance->devices.size()); + for (const auto &device : DevicesEnvironment::instance->devices) { + ur_queue_handle_t queue = nullptr; + ASSERT_SUCCESS(urQueueCreate(context, device, 0, &queue)); + queues.push_back(queue); + } + } + + void TearDown() override { + for (const auto &queue : queues) { + EXPECT_SUCCESS(urQueueRelease(queue)); + } + UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceMemImageTest::TearDown()); + } + + std::vector queues; +}; + +struct urMultiDeviceMemImageWriteTest : urMultiDeviceMemImageQueueTest { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceMemImageQueueTest::SetUp()); + + ASSERT_SUCCESS(urEnqueueMemImageWrite(queues[0], image1D, true, origin, + region1D, 0, 0, input1D.data(), 0, + nullptr, nullptr)); + ASSERT_SUCCESS(urEnqueueMemImageWrite(queues[0], image2D, true, origin, + region2D, 0, 0, input2D.data(), 0, + nullptr, nullptr)); + ASSERT_SUCCESS(urEnqueueMemImageWrite(queues[0], image3D, true, origin, + region3D, 0, 0, input3D.data(), 0, + nullptr, nullptr)); + } + + void TearDown() override { + UUR_RETURN_ON_FATAL_FAILURE(urMultiDeviceMemImageQueueTest::TearDown()); + } + + std::vector input1D = std::vector(width * 4, 42); + std::vector input2D = + std::vector(width * height * 4, 42); + std::vector input3D = + std::vector(width * height * depth * 4, 42); +}; + struct urUSMDeviceAllocTest : urQueueTest { void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE(uur::urQueueTest::SetUp()); From c88c0e38469b483eac73102a31b9127dd7fdb2a7 Mon Sep 17 00:00:00 2001 From: Weronika Lewandowska Date: Wed, 11 Oct 2023 15:58:58 +0200 Subject: [PATCH 063/145] [UR][E2E][CUDA] Add E2E Cuda nightly workflow --- .github/workflows/e2e_nightly.yml | 122 ++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 .github/workflows/e2e_nightly.yml diff --git a/.github/workflows/e2e_nightly.yml b/.github/workflows/e2e_nightly.yml new file mode 100644 index 0000000000..46a27b385e --- /dev/null +++ b/.github/workflows/e2e_nightly.yml @@ -0,0 +1,122 @@ +name: E2E Nightly + +on: + schedule: + # Run every day at 23:00 UTC + - cron: '0 23 * * *' + +jobs: + e2e-build-hw: + name: Build SYCL, UR, run E2E + strategy: + matrix: + adapter: [ + {name: CUDA} + ] + build_type: [Release] + compiler: [{c: clang, cxx: clang++}] + + runs-on: ${{matrix.adapter.name}} + + steps: + - name: Checkout UR + uses: actions/checkout@v4 + with: + ref: adapters + path: ur-repo + + - name: Checkout SYCL + uses: actions/checkout@v4 + with: + repository: intel/llvm + ref: sycl + path: sycl-repo + + - name: Install pip packages + working-directory: ${{github.workspace}}/ur-repo + run: pip install -r third_party/requirements.txt + + - name: Download DPC++ + run: | + wget -O dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz + mkdir dpcpp_compiler + tar -xvf dpcpp_compiler.tar.gz -C dpcpp_compiler + + - name: Configure CMake UR + working-directory: ${{github.workspace}}/ur-repo + run: > + cmake + -B build + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} + -DUR_ENABLE_TRACING=ON + -DUR_DEVELOPER_MODE=ON + -DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON + -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ + + - name: Build UR + run: LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib + cmake --build ${{github.workspace}}/ur-repo/build -j $(nproc) + + - name: Set env vars & pre setup + run: | + echo "SYCL_PREFER_UR=1" >> $GITHUB_ENV + echo "CUDA_LIB_PATH=/usr/local/cuda/lib64/stubs" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV + source /opt/intel/oneapi/setvars.sh + sycl-ls + + - name: Configure SYCL + run: > + python3 sycl-repo/buildbot/configure.py + -t ${{matrix.build_type}} + -o ${{github.workspace}}/sycl_build + --cmake-gen "Unix Makefiles" + --ci-defaults --cuda --hip + --cmake-opt="-DLLVM_INSTALL_UTILS=ON" + --cmake-opt="-DSYCL_PI_TESTS=OFF" + --cmake-opt=-DCMAKE_C_COMPILER_LAUNCHER=ccache + --cmake-opt=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache + + - name: Build SYCL + run: cmake --build ${{github.workspace}}/sycl_build + + - name: Run check-sycl + # Remove after fixing SYCL test :: abi/layout_handler.cpp + # This issue does not affect further execution of e2e with UR. + continue-on-error: true + run: cmake --build ${{github.workspace}}/sycl_build --target check-sycl + + - name: Swap UR loader and adapters + run: | + cp ${{github.workspace}}/ur-repo/build/lib/libur_loader.so* ${{github.workspace}}/sycl_build/lib/ + cp ${{github.workspace}}/ur-repo/build/lib/libur_adapter_cuda.so* ${{github.workspace}}/sycl_build/lib/ + + - name: Setup SYCL + run: | + echo "${{github.workspace}}/sycl_build/bin" >> $GITHUB_PATH + echo "LD_LIBRARY_PATH=${{github.workspace}}/sycl_build/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + which clang++ sycl-ls + SYCL_PI_TRACE=-1 sycl-ls + + - name: Build e2e tests + run: > + cmake + -GNinja + -B ${{github.workspace}}/build-e2e/ + -S ${{github.workspace}}/sycl-repo/sycl/test-e2e/ + -DSYCL_TEST_E2E_TARGETS="ext_oneapi_cuda:gpu" + -DCMAKE_CXX_COMPILER="$(which clang++)" + -DLLVM_LIT="${{github.workspace}}/sycl-repo/llvm/utils/lit/lit.py" + + - name: Run e2e tests + run: ninja -C build-e2e check-sycl-e2e + + # Workspace on self-hosted runners is not cleaned automatically. + # We have to delete the files created outside of using actions. + - name: Cleanup self-hosted workspace + if: always() + run: | + ls -la ./ + rm -rf ./* || true From 21e183491d16c55659543fecc3efb233e479b11a Mon Sep 17 00:00:00 2001 From: Weronika Lewandowska Date: Mon, 16 Oct 2023 13:11:33 +0200 Subject: [PATCH 064/145] [UR][E2E][CUDA] e2e nightly improvements --- .github/workflows/e2e_nightly.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/e2e_nightly.yml b/.github/workflows/e2e_nightly.yml index 46a27b385e..8dbb5d3e74 100644 --- a/.github/workflows/e2e_nightly.yml +++ b/.github/workflows/e2e_nightly.yml @@ -19,6 +19,14 @@ jobs: runs-on: ${{matrix.adapter.name}} steps: + # Workspace on self-hosted runners is not cleaned automatically. + # We have to delete the files created outside of using actions. + - name: Cleanup self-hosted workspace + if: always() + run: | + ls -la ./ + rm -rf ./* || true + - name: Checkout UR uses: actions/checkout@v4 with: @@ -36,12 +44,6 @@ jobs: working-directory: ${{github.workspace}}/ur-repo run: pip install -r third_party/requirements.txt - - name: Download DPC++ - run: | - wget -O dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/nightly-2023-09-21/sycl_linux.tar.gz - mkdir dpcpp_compiler - tar -xvf dpcpp_compiler.tar.gz -C dpcpp_compiler - - name: Configure CMake UR working-directory: ${{github.workspace}}/ur-repo run: > @@ -53,7 +55,6 @@ jobs: -DUR_ENABLE_TRACING=ON -DUR_DEVELOPER_MODE=ON -DUR_BUILD_ADAPTER_${{matrix.adapter.name}}=ON - -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ - name: Build UR run: LD_LIBRARY_PATH=${{github.workspace}}/dpcpp_compiler/lib @@ -112,11 +113,3 @@ jobs: - name: Run e2e tests run: ninja -C build-e2e check-sycl-e2e - - # Workspace on self-hosted runners is not cleaned automatically. - # We have to delete the files created outside of using actions. - - name: Cleanup self-hosted workspace - if: always() - run: | - ls -la ./ - rm -rf ./* || true From 050223799e78743607ef8b5d94563256ea4aa0f3 Mon Sep 17 00:00:00 2001 From: Damian Duy Date: Mon, 9 Oct 2023 09:25:20 +0200 Subject: [PATCH 065/145] [umf] change default MinBucketSize and ensure buckets are generated from the min size 8 --- source/common/umf_pools/disjoint_pool.cpp | 2 ++ source/common/umf_pools/disjoint_pool.hpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/common/umf_pools/disjoint_pool.cpp b/source/common/umf_pools/disjoint_pool.cpp index dcccb25c3b..7259c977ed 100644 --- a/source/common/umf_pools/disjoint_pool.cpp +++ b/source/common/umf_pools/disjoint_pool.cpp @@ -293,6 +293,8 @@ class DisjointPool::AllocImpl { // Generate buckets sized such as: 64, 96, 128, 192, ..., CutOff. // Powers of 2 and the value halfway between the powers of 2. auto Size1 = params.MinBucketSize; + // Buckets sized smaller than the bucket default size- 8 aren't needed. + Size1 = std::max(Size1, MIN_BUCKET_DEFAULT_SIZE); auto Size2 = Size1 + Size1 / 2; for (; Size2 < CutOff; Size1 *= 2, Size2 *= 2) { Buckets.push_back(std::make_unique(Size1, *this)); diff --git a/source/common/umf_pools/disjoint_pool.hpp b/source/common/umf_pools/disjoint_pool.hpp index f5b67ef3ed..2c465eff3c 100644 --- a/source/common/umf_pools/disjoint_pool.hpp +++ b/source/common/umf_pools/disjoint_pool.hpp @@ -17,6 +17,8 @@ namespace usm { +inline constexpr size_t MIN_BUCKET_DEFAULT_SIZE = 8; + // Configuration for specific USM allocator instance class DisjointPoolConfig { public: @@ -46,7 +48,7 @@ class DisjointPoolConfig { // Holds the minimum bucket size valid for allocation of a memory type. // This value must be a power of 2. - size_t MinBucketSize = 1; + size_t MinBucketSize = MIN_BUCKET_DEFAULT_SIZE; // Holds size of the pool managed by the allocator. size_t CurPoolSize = 0; From 088401b6b2cac186778659cb0aca043abf5417a0 Mon Sep 17 00:00:00 2001 From: pbalcer Date: Fri, 13 Oct 2023 16:25:21 +0200 Subject: [PATCH 066/145] [ur][loader] add code location callback for tracing layer This addresses the gap between XPTI support in PI and UR, where UR implementation was unable to provide code location information in traces, by adding an optional callback that, when set, allows language runtimes to provide this information. --- include/ur.py | 19 +++++ include/ur_api.h | 54 ++++++++++++++ scripts/core/loader.yml | 47 ++++++++++++ scripts/core/registry.yml | 3 + scripts/templates/trcddi.cpp.mako | 5 +- scripts/templates/valddi.cpp.mako | 5 +- source/common/ur_params.hpp | 58 +++++++++++++++ source/loader/CMakeLists.txt | 1 + .../layers/tracing/ur_tracing_layer.cpp | 15 +++- .../layers/tracing/ur_tracing_layer.hpp | 4 +- source/loader/layers/tracing/ur_trcddi.cpp | 5 +- source/loader/layers/ur_proxy_layer.hpp | 7 +- source/loader/layers/validation/ur_valddi.cpp | 3 +- .../layers/validation/ur_validation_layer.hpp | 3 +- source/loader/ur_codeloc.hpp | 35 +++++++++ source/loader/ur_lib.cpp | 21 +++++- source/loader/ur_lib.hpp | 10 +++ source/loader/ur_libapi.cpp | 34 +++++++++ source/ur_api.cpp | 32 ++++++++ test/layers/tracing/CMakeLists.txt | 64 +++++++++++++--- test/layers/tracing/codeloc.cpp | 53 +++++++++++++ test/layers/tracing/codeloc.out.match | 2 + test/layers/tracing/test_collector.cpp | 74 +++++++++++++++++++ 23 files changed, 531 insertions(+), 23 deletions(-) create mode 100644 source/loader/ur_codeloc.hpp create mode 100644 test/layers/tracing/codeloc.cpp create mode 100644 test/layers/tracing/codeloc.out.match create mode 100644 test/layers/tracing/test_collector.cpp diff --git a/include/ur.py b/include/ur.py index d949558c9c..13996b1815 100644 --- a/include/ur.py +++ b/include/ur.py @@ -202,6 +202,7 @@ class ur_function_v(IntEnum): KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195 ## Enumerator for ::urCommandBufferAppendUSMPrefetchExp COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196 ## Enumerator for ::urCommandBufferAppendUSMAdviseExp + LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 197 ## Enumerator for ::urLoaderConfigSetCodeLocationCallback class ur_function_t(c_int): def __str__(self): @@ -518,6 +519,24 @@ def __str__(self): return str(ur_loader_config_info_v(self.value)) +############################################################################### +## @brief Code location data +class ur_code_location_t(Structure): + _fields_ = [ + ("functionName", c_char_p), ## [in][out] Function name. + ("sourceFile", c_char_p), ## [in][out] Source code file. + ("lineNumber", c_ulong), ## [in][out] Source code line number. + ("columnNumber", c_ulong) ## [in][out] Source code column number. + ] + +############################################################################### +## @brief Code location callback with user data. +def ur_code_location_callback_t(user_defined_callback): + @CFUNCTYPE(ur_code_location_t, c_void_p) + def ur_code_location_callback_t_wrapper(pUserData): + return user_defined_callback(pUserData) + return ur_code_location_callback_t_wrapper + ############################################################################### ## @brief Supported adapter info class ur_adapter_info_v(IntEnum): diff --git a/include/ur_api.h b/include/ur_api.h index 37470abdb8..1504c0b1b2 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -211,6 +211,7 @@ typedef enum ur_function_t { UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp + UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 197, ///< Enumerator for ::urLoaderConfigSetCodeLocationCallback /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -675,6 +676,49 @@ urLoaderConfigEnableLayer( ///< enable. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Code location data +typedef struct ur_code_location_t { + const char *functionName; ///< [in][out] Function name. + const char *sourceFile; ///< [in][out] Source code file. + uint32_t lineNumber; ///< [in][out] Source code line number. + uint32_t columnNumber; ///< [in][out] Source code column number. + +} ur_code_location_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Code location callback with user data. +typedef ur_code_location_t (*ur_code_location_callback_t)( + void *pUserData ///< [in][out] pointer to data to be passed to callback +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a function callback for use by the loader to retrieve code +/// location information. +/// +/// @details +/// - The code location callback is optional and provides additional +/// information to the tracing layer about the entry point of the current +/// execution flow. +/// - This functionality can be used to match traced unified runtime +/// function calls with higher-level user calls. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnCodeloc` +UR_APIEXPORT ur_result_t UR_APICALL +urLoaderConfigSetCodeLocationCallback( + ur_loader_config_handle_t hLoaderConfig, ///< [in] Handle to config object the layer will be enabled for. + ur_code_location_callback_t pfnCodeloc, ///< [in] Function pointer to code location callback. + void *pUserData ///< [in][out][optional] pointer to data to be passed to callback. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' loader /// @@ -8618,6 +8662,16 @@ typedef struct ur_loader_config_enable_layer_params_t { const char **ppLayerName; } ur_loader_config_enable_layer_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urLoaderConfigSetCodeLocationCallback +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_loader_config_set_code_location_callback_params_t { + ur_loader_config_handle_t *phLoaderConfig; + ur_code_location_callback_t *ppfnCodeloc; + void **ppUserData; +} ur_loader_config_set_code_location_callback_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urPlatformGet /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/scripts/core/loader.yml b/scripts/core/loader.yml index c0311bd31a..b5ad1eadec 100644 --- a/scripts/core/loader.yml +++ b/scripts/core/loader.yml @@ -140,6 +140,53 @@ returns: - $X_RESULT_ERROR_LAYER_NOT_PRESENT: - "If layer specified with `pLayerName` can't be found by the loader." --- #-------------------------------------------------------------------------- +type: struct +desc: "Code location data" +class: $xLoaderConfig +name: $x_code_location_t +members: + - type: const char* + name: functionName + desc: "[in][out] Function name." + - type: const char* + name: sourceFile + desc: "[in][out] Source code file." + - type: uint32_t + name: lineNumber + desc: "[in][out] Source code line number." + - type: uint32_t + name: columnNumber + desc: "[in][out] Source code column number." +--- #-------------------------------------------------------------------------- +type: fptr_typedef +desc: "Code location callback with user data." +name: $x_code_location_callback_t +return: $x_code_location_t +params: + - type: void* + name: pUserData + desc: "[in][out] pointer to data to be passed to callback" +--- #-------------------------------------------------------------------------- +type: function +desc: "Set a function callback for use by the loader to retrieve code location information." +details: + - "The code location callback is optional and provides additional information to the tracing layer about the entry point of the current execution flow." + - "This functionality can be used to match traced unified runtime function calls with higher-level user calls." +class: $xLoaderConfig +loader_only: True +name: SetCodeLocationCallback +decl: static +params: + - type: $x_loader_config_handle_t + name: hLoaderConfig + desc: "[in] Handle to config object the layer will be enabled for." + - type: $x_code_location_callback_t + name: pfnCodeloc + desc: "[in] Function pointer to code location callback." + - type: void* + name: pUserData + desc: "[in][out][optional] pointer to data to be passed to callback." +--- #-------------------------------------------------------------------------- type: function desc: "Initialize the $OneApi loader" class: $xLoader diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 7952b145f5..61fb2aa690 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -547,6 +547,9 @@ etors: - name: COMMAND_BUFFER_APPEND_USM_ADVISE_EXP desc: Enumerator for $xCommandBufferAppendUSMAdviseExp value: '196' +- name: LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK + desc: Enumerator for $xLoaderConfigSetCodeLocationCallback + value: '197' --- type: enum desc: Defines structure types diff --git a/scripts/templates/trcddi.cpp.mako b/scripts/templates/trcddi.cpp.mako index 9a2eb3e319..2ace43072b 100644 --- a/scripts/templates/trcddi.cpp.mako +++ b/scripts/templates/trcddi.cpp.mako @@ -104,13 +104,16 @@ namespace ur_tracing_layer ${x}_result_t context_t::init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) { + const std::set &enabledLayerNames, + codeloc_data codelocData) { ${x}_result_t result = ${X}_RESULT_SUCCESS; if(!enabledLayerNames.count(name)) { return result; } + ur_tracing_layer::context.codelocData = codelocData; + %for tbl in th.get_pfntables(specs, meta, n, tags): if( ${X}_RESULT_SUCCESS == result ) { diff --git a/scripts/templates/valddi.cpp.mako b/scripts/templates/valddi.cpp.mako index c99328727d..f3ec24bfb9 100644 --- a/scripts/templates/valddi.cpp.mako +++ b/scripts/templates/valddi.cpp.mako @@ -160,9 +160,10 @@ namespace ur_validation_layer %endfor ${x}_result_t context_t::init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) { + const std::set &enabledLayerNames, + codeloc_data) { ${x}_result_t result = ${X}_RESULT_SUCCESS; - + if (enabledLayerNames.count(nameFullValidation)) { enableParameterValidation = true; enableLeakChecking = true; diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index fba0beedbd..9d7779ea2d 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -240,6 +240,9 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_init_flag_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_loader_config_info_t value); +inline std::ostream & +operator<<(std::ostream &os, + [[maybe_unused]] const struct ur_code_location_t params); inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_info_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_backend_t value); @@ -1202,6 +1205,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP"; break; + + case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: + os << "UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK"; + break; default: os << "unknown enumerator"; break; @@ -2170,6 +2177,32 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } } } // namespace ur_params +inline std::ostream &operator<<(std::ostream &os, + const struct ur_code_location_t params) { + os << "(struct ur_code_location_t){"; + + os << ".functionName = "; + + ur_params::serializePtr(os, (params.functionName)); + + os << ", "; + os << ".sourceFile = "; + + ur_params::serializePtr(os, (params.sourceFile)); + + os << ", "; + os << ".lineNumber = "; + + os << (params.lineNumber); + + os << ", "; + os << ".columnNumber = "; + + os << (params.columnNumber); + + os << "}"; + return os; +} inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_info_t value) { switch (value) { @@ -13873,6 +13906,27 @@ operator<<(std::ostream &os, return os; } +inline std::ostream & +operator<<(std::ostream &os, [[maybe_unused]] const struct + ur_loader_config_set_code_location_callback_params_t *params) { + + os << ".hLoaderConfig = "; + + ur_params::serializePtr(os, *(params->phLoaderConfig)); + + os << ", "; + os << ".pfnCodeloc = "; + + os << reinterpret_cast(*(params->ppfnCodeloc)); + + os << ", "; + os << ".pUserData = "; + + ur_params::serializePtr(os, *(params->ppUserData)); + + return os; +} + inline std::ostream & operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_image_create_params_t *params) { @@ -16146,6 +16200,10 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, case UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER: { os << (const struct ur_loader_config_enable_layer_params_t *)params; } break; + case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: { + os << (const struct ur_loader_config_set_code_location_callback_params_t + *)params; + } break; case UR_FUNCTION_MEM_IMAGE_CREATE: { os << (const struct ur_mem_image_create_params_t *)params; } break; diff --git a/source/loader/CMakeLists.txt b/source/loader/CMakeLists.txt index db796612ea..d4f5bc73a5 100644 --- a/source/loader/CMakeLists.txt +++ b/source/loader/CMakeLists.txt @@ -88,6 +88,7 @@ target_sources(ur_loader ${CMAKE_CURRENT_SOURCE_DIR}/ur_libddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ur_lib.hpp ${CMAKE_CURRENT_SOURCE_DIR}/ur_lib.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/ur_codeloc.hpp ${CMAKE_CURRENT_SOURCE_DIR}/layers/validation/ur_valddi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/layers/validation/ur_validation_layer.cpp ) diff --git a/source/loader/layers/tracing/ur_tracing_layer.cpp b/source/loader/layers/tracing/ur_tracing_layer.cpp index b022ae831f..dd36b286f2 100644 --- a/source/loader/layers/tracing/ur_tracing_layer.cpp +++ b/source/loader/layers/tracing/ur_tracing_layer.cpp @@ -14,6 +14,7 @@ #include "ur_util.hpp" #include "xpti/xpti_data_types.h" #include "xpti/xpti_trace_framework.h" +#include #include namespace ur_tracing_layer { @@ -23,6 +24,8 @@ constexpr auto CALL_STREAM_NAME = "ur"; constexpr auto STREAM_VER_MAJOR = UR_MAJOR_VERSION(UR_API_VERSION_CURRENT); constexpr auto STREAM_VER_MINOR = UR_MINOR_VERSION(UR_API_VERSION_CURRENT); +static thread_local xpti_td *activeEvent; + /////////////////////////////////////////////////////////////////////////////// context_t::context_t() { xptiFrameworkInitialize(); @@ -39,11 +42,21 @@ bool context_t::isAvailable() const { return xptiTraceEnabled(); } void context_t::notify(uint16_t trace_type, uint32_t id, const char *name, void *args, ur_result_t *resultp, uint64_t instance) { xpti::function_with_args_t payload{id, name, args, resultp, nullptr}; - xptiNotifySubscribers(call_stream_id, trace_type, nullptr, nullptr, + xptiNotifySubscribers(call_stream_id, trace_type, nullptr, activeEvent, instance, &payload); } uint64_t context_t::notify_begin(uint32_t id, const char *name, void *args) { + if (auto loc = codelocData.get_codeloc()) { + xpti::payload_t payload = + xpti::payload_t(loc->functionName, loc->sourceFile, loc->lineNumber, + loc->columnNumber, nullptr); + uint64_t InstanceNumber{}; + activeEvent = xptiMakeEvent("Unified Runtime call", &payload, + xpti::trace_graph_event, xpti_at::active, + &InstanceNumber); + } + uint64_t instance = xptiGetUniqueId(); notify((uint16_t)xpti::trace_point_type_t::function_with_args_begin, id, name, args, nullptr, instance); diff --git a/source/loader/layers/tracing/ur_tracing_layer.hpp b/source/loader/layers/tracing/ur_tracing_layer.hpp index 04a2d7c857..ddda493c05 100644 --- a/source/loader/layers/tracing/ur_tracing_layer.hpp +++ b/source/loader/layers/tracing/ur_tracing_layer.hpp @@ -24,6 +24,7 @@ namespace ur_tracing_layer { class __urdlllocal context_t : public proxy_layer_context_t { public: ur_dditable_t urDdiTable = {}; + codeloc_data codelocData; context_t(); ~context_t(); @@ -32,7 +33,8 @@ class __urdlllocal context_t : public proxy_layer_context_t { std::vector getNames() const override { return {name}; } ur_result_t init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) override; + const std::set &enabledLayerNames, + codeloc_data codelocData) override; ur_result_t tearDown() override { return UR_RESULT_SUCCESS; } uint64_t notify_begin(uint32_t id, const char *name, void *args); void notify_end(uint32_t id, const char *name, void *args, diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 018d245da3..4cd712dbbe 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -7222,13 +7222,16 @@ __urdlllocal ur_result_t UR_APICALL urGetDeviceProcAddrTable( } ur_result_t context_t::init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) { + const std::set &enabledLayerNames, + codeloc_data codelocData) { ur_result_t result = UR_RESULT_SUCCESS; if (!enabledLayerNames.count(name)) { return result; } + ur_tracing_layer::context.codelocData = codelocData; + if (UR_RESULT_SUCCESS == result) { result = ur_tracing_layer::urGetGlobalProcAddrTable( UR_API_VERSION_CURRENT, &dditable->Global); diff --git a/source/loader/layers/ur_proxy_layer.hpp b/source/loader/layers/ur_proxy_layer.hpp index 20bb47394e..2b710f3287 100644 --- a/source/loader/layers/ur_proxy_layer.hpp +++ b/source/loader/layers/ur_proxy_layer.hpp @@ -12,6 +12,7 @@ #ifndef UR_PROXY_LAYER_H #define UR_PROXY_LAYER_H 1 +#include "ur_codeloc.hpp" #include "ur_ddi.h" #include "ur_util.hpp" @@ -24,9 +25,9 @@ class __urdlllocal proxy_layer_context_t { virtual std::vector getNames() const = 0; virtual bool isAvailable() const = 0; - virtual ur_result_t - init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) = 0; + virtual ur_result_t init(ur_dditable_t *dditable, + const std::set &enabledLayerNames, + codeloc_data codelocData) = 0; virtual ur_result_t tearDown() = 0; }; diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index b4298dacf3..dca284e0d1 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -8991,7 +8991,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetDeviceProcAddrTable( } ur_result_t context_t::init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) { + const std::set &enabledLayerNames, + codeloc_data) { ur_result_t result = UR_RESULT_SUCCESS; if (enabledLayerNames.count(nameFullValidation)) { diff --git a/source/loader/layers/validation/ur_validation_layer.hpp b/source/loader/layers/validation/ur_validation_layer.hpp index bab9e56e88..e41c621dc8 100644 --- a/source/loader/layers/validation/ur_validation_layer.hpp +++ b/source/loader/layers/validation/ur_validation_layer.hpp @@ -34,7 +34,8 @@ class __urdlllocal context_t : public proxy_layer_context_t { return {nameFullValidation, nameParameterValidation, nameLeakChecking}; } ur_result_t init(ur_dditable_t *dditable, - const std::set &enabledLayerNames) override; + const std::set &enabledLayerNames, + codeloc_data codelocData) override; ur_result_t tearDown() override; private: diff --git a/source/loader/ur_codeloc.hpp b/source/loader/ur_codeloc.hpp new file mode 100644 index 0000000000..176ba0b13c --- /dev/null +++ b/source/loader/ur_codeloc.hpp @@ -0,0 +1,35 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + * @file ur_codeloc.hpp + * + */ + +#ifndef UR_CODELOC_HPP +#define UR_CODELOC_HPP 1 + +#include "ur_api.h" +#include + +struct codeloc_data { + codeloc_data() { + codelocCb = nullptr; + codelocUserdata = nullptr; + } + ur_code_location_callback_t codelocCb; + void *codelocUserdata; + + std::optional get_codeloc() { + if (!codelocCb) { + return std::nullopt; + } + return codelocCb(codelocUserdata); + } +}; + +#endif /* UR_CODELOC_HPP */ diff --git a/source/loader/ur_lib.cpp b/source/loader/ur_lib.cpp index 8f704a3322..34531ca8b1 100644 --- a/source/loader/ur_lib.cpp +++ b/source/loader/ur_lib.cpp @@ -55,7 +55,7 @@ void context_t::parseEnvEnabledLayers() { void context_t::initLayers() const { for (auto &l : layers) { if (l->isAvailable()) { - l->init(&context->urDdiTable, enabledLayerNames); + l->init(&context->urDdiTable, enabledLayerNames, codelocData); } } } @@ -83,6 +83,7 @@ __urdlllocal ur_result_t context_t::Init( } if (hLoaderConfig) { + codelocData = hLoaderConfig->codelocData; enabledLayerNames.merge(hLoaderConfig->getEnabledLayerNames()); } @@ -187,4 +188,22 @@ ur_result_t urLoaderTearDown() { return UR_RESULT_SUCCESS; } + +ur_result_t +urLoaderConfigSetCodeLocationCallback(ur_loader_config_handle_t hLoaderConfig, + ur_code_location_callback_t pfnCodeloc, + void *pUserData) { + if (!hLoaderConfig) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + if (!pfnCodeloc) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + hLoaderConfig->codelocData.codelocCb = pfnCodeloc; + hLoaderConfig->codelocData.codelocUserdata = pUserData; + + return UR_RESULT_SUCCESS; +} + } // namespace ur_lib diff --git a/source/loader/ur_lib.hpp b/source/loader/ur_lib.hpp index 58ee62b936..9d1e02a67e 100644 --- a/source/loader/ur_lib.hpp +++ b/source/loader/ur_lib.hpp @@ -14,6 +14,7 @@ #define UR_LOADER_LIB_H 1 #include "ur_api.h" +#include "ur_codeloc.hpp" #include "ur_ddi.h" #include "ur_proxy_layer.hpp" #include "ur_util.hpp" @@ -42,6 +43,8 @@ struct ur_loader_config_handle_t_ { return refCount.load(std::memory_order_acquire); } std::set &getEnabledLayerNames() { return enabledLayers; } + + codeloc_data codelocData; }; namespace ur_lib { @@ -72,6 +75,8 @@ class __urdlllocal context_t { std::string availableLayers; std::set enabledLayerNames; + codeloc_data codelocData; + bool layerExists(const std::string &layerName) const; void parseEnvEnabledLayers(); void initLayers() const; @@ -89,5 +94,10 @@ ur_result_t urLoaderConfigGetInfo(ur_loader_config_handle_t hLoaderConfig, ur_result_t urLoaderConfigEnableLayer(ur_loader_config_handle_t hLoaderConfig, const char *pLayerName); ur_result_t urLoaderTearDown(); +ur_result_t +urLoaderConfigSetCodeLocationCallback(ur_loader_config_handle_t hLoaderConfig, + ur_code_location_callback_t pfnCodeloc, + void *pUserData); + } // namespace ur_lib #endif /* UR_LOADER_LIB_H */ diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index b66833feff..374f193902 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -157,6 +157,40 @@ ur_result_t UR_APICALL urLoaderConfigEnableLayer( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a function callback for use by the loader to retrieve code +/// location information. +/// +/// @details +/// - The code location callback is optional and provides additional +/// information to the tracing layer about the entry point of the current +/// execution flow. +/// - This functionality can be used to match traced unified runtime +/// function calls with higher-level user calls. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnCodeloc` +ur_result_t UR_APICALL urLoaderConfigSetCodeLocationCallback( + ur_loader_config_handle_t + hLoaderConfig, ///< [in] Handle to config object the layer will be enabled for. + ur_code_location_callback_t + pfnCodeloc, ///< [in] Function pointer to code location callback. + void * + pUserData ///< [in][out][optional] pointer to data to be passed to callback. + ) try { + return ur_lib::urLoaderConfigSetCodeLocationCallback(hLoaderConfig, + pfnCodeloc, pUserData); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' loader /// diff --git a/source/ur_api.cpp b/source/ur_api.cpp index cfb6e87d63..d465a83cfa 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -148,6 +148,38 @@ ur_result_t UR_APICALL urLoaderConfigEnableLayer( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Set a function callback for use by the loader to retrieve code +/// location information. +/// +/// @details +/// - The code location callback is optional and provides additional +/// information to the tracing layer about the entry point of the current +/// execution flow. +/// - This functionality can be used to match traced unified runtime +/// function calls with higher-level user calls. +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hLoaderConfig` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == pfnCodeloc` +ur_result_t UR_APICALL urLoaderConfigSetCodeLocationCallback( + ur_loader_config_handle_t + hLoaderConfig, ///< [in] Handle to config object the layer will be enabled for. + ur_code_location_callback_t + pfnCodeloc, ///< [in] Function pointer to code location callback. + void * + pUserData ///< [in][out][optional] pointer to data to be passed to callback. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Initialize the 'oneAPI' loader /// diff --git a/test/layers/tracing/CMakeLists.txt b/test/layers/tracing/CMakeLists.txt index db4b9da590..2ccb4f69b0 100644 --- a/test/layers/tracing/CMakeLists.txt +++ b/test/layers/tracing/CMakeLists.txt @@ -3,9 +3,36 @@ # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -set(TEST_NAME example-collected-hello-world) +add_ur_library(test_collector SHARED + ${CMAKE_CURRENT_SOURCE_DIR}/test_collector.cpp +) + +target_include_directories(test_collector PRIVATE + ${CMAKE_SOURCE_DIR}/include +) + +target_link_libraries(test_collector PRIVATE ${TARGET_XPTI}) +target_include_directories(test_collector PRIVATE ${xpti_SOURCE_DIR}/include) + +if(MSVC) + target_compile_definitions(test_collector PRIVATE + XPTI_STATIC_LIBRARY XPTI_CALLBACK_API_EXPORTS) +endif() -add_test(NAME ${TEST_NAME} +function(set_tracing_test_props target_name collector_name) + set_tests_properties(${target_name} PROPERTIES + LABELS "tracing" + ) + + set_property(TEST ${target_name} PROPERTY ENVIRONMENT + "XPTI_TRACE_ENABLE=1" + "XPTI_FRAMEWORK_DISPATCHER=$" + "XPTI_SUBSCRIBERS=$" + "UR_ADAPTERS_FORCE_LOAD=\"$\"" + "UR_ENABLE_LAYERS=UR_LAYER_TRACING") +endfunction() + +add_test(NAME example-collected-hello-world COMMAND ${CMAKE_COMMAND} -D MODE=stdout -D TEST_FILE=$ @@ -14,13 +41,28 @@ add_test(NAME ${TEST_NAME} DEPENDS collector hello_world ) -set_tests_properties(${TEST_NAME} PROPERTIES - LABELS "tracing" -) +set_tracing_test_props(example-collected-hello-world collector) + +function(add_tracing_test name) + set(TEST_TARGET_NAME tracing-test-${name}) + add_ur_executable(${TEST_TARGET_NAME} + ${ARGN}) + target_link_libraries(${TEST_TARGET_NAME} + PRIVATE + ${PROJECT_NAME}::loader + ${PROJECT_NAME}::headers + ${PROJECT_NAME}::testing + GTest::gtest_main) + add_test(NAME ${name} + COMMAND ${CMAKE_COMMAND} + -D MODE=stderr + -D TEST_FILE=$ + -D MATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}.out.match + -P ${PROJECT_SOURCE_DIR}/cmake/match.cmake + DEPENDS test_collector + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + ) + set_tracing_test_props(${name} test_collector) +endfunction() -set_property(TEST ${TEST_NAME} PROPERTY ENVIRONMENT - "XPTI_TRACE_ENABLE=1" - "XPTI_FRAMEWORK_DISPATCHER=$" - "XPTI_SUBSCRIBERS=$" - "UR_ADAPTERS_FORCE_LOAD=\"$\"" - "UR_ENABLE_LAYERS=UR_LAYER_TRACING") +add_tracing_test(codeloc codeloc.cpp) diff --git a/test/layers/tracing/codeloc.cpp b/test/layers/tracing/codeloc.cpp new file mode 100644 index 0000000000..e0f1f91df1 --- /dev/null +++ b/test/layers/tracing/codeloc.cpp @@ -0,0 +1,53 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + * @file codeloc.cpp + * + */ + +#include +#include + +struct ur_code_location_t test_callback(void *userdata) { + (void)userdata; + + ur_code_location_t codeloc; + codeloc.columnNumber = 1; + codeloc.lineNumber = 2; + codeloc.functionName = "fname"; + codeloc.sourceFile = "sfile"; + + return codeloc; +} + +TEST(LoaderCodeloc, NullCallback) { + ur_loader_config_handle_t loader_config; + ASSERT_EQ(urLoaderConfigCreate(&loader_config), UR_RESULT_SUCCESS); + ASSERT_EQ( + urLoaderConfigSetCodeLocationCallback(loader_config, nullptr, nullptr), + UR_RESULT_ERROR_INVALID_NULL_POINTER); + urLoaderConfigRelease(loader_config); +} + +TEST(LoaderCodeloc, NullHandle) { + ASSERT_EQ( + urLoaderConfigSetCodeLocationCallback(nullptr, test_callback, nullptr), + UR_RESULT_ERROR_INVALID_NULL_HANDLE); +} + +TEST(LoaderCodeloc, Success) { + ur_loader_config_handle_t loader_config; + ASSERT_EQ(urLoaderConfigCreate(&loader_config), UR_RESULT_SUCCESS); + ASSERT_EQ(urLoaderConfigSetCodeLocationCallback(loader_config, + test_callback, nullptr), + UR_RESULT_SUCCESS); + urLoaderInit(0, loader_config); + uint32_t nadapters; + urAdapterGet(0, nullptr, &nadapters); + urLoaderConfigRelease(loader_config); +} diff --git a/test/layers/tracing/codeloc.out.match b/test/layers/tracing/codeloc.out.match new file mode 100644 index 0000000000..dc0c2e1335 --- /dev/null +++ b/test/layers/tracing/codeloc.out.match @@ -0,0 +1,2 @@ +begin urAdapterGet 178 fname sfile 2 1 +end urAdapterGet 178 fname sfile 2 1 diff --git a/test/layers/tracing/test_collector.cpp b/test/layers/tracing/test_collector.cpp new file mode 100644 index 0000000000..6c942c63ec --- /dev/null +++ b/test/layers/tracing/test_collector.cpp @@ -0,0 +1,74 @@ +/* + * + * Copyright (C) 2023 Intel Corporation + * + * Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. + * See LICENSE.TXT + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + * @file test_collector.cpp + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "ur_api.h" +#include "xpti/xpti_trace_framework.h" + +constexpr uint16_t TRACE_FN_BEGIN = + static_cast(xpti::trace_point_type_t::function_with_args_begin); +constexpr uint16_t TRACE_FN_END = + static_cast(xpti::trace_point_type_t::function_with_args_end); +constexpr std::string_view UR_STREAM_NAME = "ur"; + +XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, + xpti::trace_event_data_t *child, uint64_t, + const void *user_data) { + auto *args = static_cast(user_data); + auto *payload = xptiQueryPayload(child); + std::cerr << (trace_type == TRACE_FN_BEGIN ? "begin" : "end"); + std::cerr << " " << args->function_name << " " << args->function_id; + if (payload) { + std::cerr << " " << payload->name << " " << payload->source_file << " " + << payload->line_no << " " << payload->column_no; + } + std::cerr << std::endl; +} + +XPTI_CALLBACK_API void xptiTraceInit(unsigned int major_version, + unsigned int minor_version, const char *, + const char *stream_name) { + if (stream_name == nullptr) { + std::cout << "Stream name not provided. Aborting." << std::endl; + return; + } + if (std::string_view(stream_name) != UR_STREAM_NAME) { + std::cout << "Invalid stream name: " << stream_name << ". Expected " + << UR_STREAM_NAME << ". Aborting." << std::endl; + return; + } + + if (UR_MAKE_VERSION(major_version, minor_version) != + UR_API_VERSION_CURRENT) { + std::cout << "Invalid stream version: " << major_version << "." + << minor_version << ". Expected " + << UR_MAJOR_VERSION(UR_API_VERSION_CURRENT) << "." + << UR_MINOR_VERSION(UR_API_VERSION_CURRENT) << ". Aborting." + << std::endl; + return; + } + + uint8_t stream_id = xptiRegisterStream(stream_name); + + xptiRegisterCallback(stream_id, TRACE_FN_BEGIN, trace_cb); + xptiRegisterCallback(stream_id, TRACE_FN_END, trace_cb); +} + +XPTI_CALLBACK_API void xptiTraceFinish(const char *) { /* noop */ +} From 08310d966ca327f46f11dbe191e81ee682a1f6e5 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 19 Oct 2023 13:51:37 +0100 Subject: [PATCH 067/145] Update contribution guide to link to dependent PRs Since merging into the adapters branch imposes an ordering on changes which should be merged into intel/llvm, expand step 7 of the *Adapter Change Process* to include linking to dependent intel/llvm PR's to communicate this ordering to the maintainers. --- scripts/core/CONTRIB.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/core/CONTRIB.rst b/scripts/core/CONTRIB.rst index 6b4a907e71..b9d4130d5a 100644 --- a/scripts/core/CONTRIB.rst +++ b/scripts/core/CONTRIB.rst @@ -85,6 +85,10 @@ Adapter Change Process * Update the `UNIFIED_RUNTIME_TAG`_ to point at the *oneapi-src/unified-runtime* commit/tag containing the merged adapter changes. + * Update the pull request description, linking to any other *intel/llvm* + pull requests who's changes have been merged into + *oneapi-src/unified-runtime* but have not yet been merge into + *intel/llvm*. * Mark the *intel/llvm* pull request as ready for review and follow their review process. From eff80636e5b5a79a53aeb677b5804739e7214841 Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Tue, 5 Sep 2023 12:32:59 +0200 Subject: [PATCH 068/145] Rename params stringifier --- scripts/generate_code.py | 8 +- .../{params.hpp.mako => print.hpp.mako} | 74 +- source/common/{ur_params.hpp => ur_print.hpp} | 2152 ++++++++--------- test/conformance/testing/include/uur/checks.h | 2 +- test/loader/loader_lifetime/urLoaderInit.cpp | 4 +- test/loader/platforms/platforms.cpp | 2 +- test/unit/utils/params.cpp | 10 +- tools/urtrace/collector.cpp | 8 +- 8 files changed, 1117 insertions(+), 1143 deletions(-) rename scripts/templates/{params.hpp.mako => print.hpp.mako} (84%) rename source/common/{ur_params.hpp => ur_print.hpp} (86%) diff --git a/scripts/generate_code.py b/scripts/generate_code.py index 3c4b3107a3..0d391b1747 100644 --- a/scripts/generate_code.py +++ b/scripts/generate_code.py @@ -278,11 +278,11 @@ def _mako_tracing_layer_cpp(path, namespace, tags, version, specs, meta): """ generates c/c++ files from the specification documents """ -def _mako_params_hpp(path, namespace, tags, version, specs, meta): - template = "params.hpp.mako" +def _mako_print_hpp(path, namespace, tags, version, specs, meta): + template = "print.hpp.mako" fin = os.path.join(templates_dir, template) - name = "%s_params"%(namespace) + name = "%s_print"%(namespace) filename = "%s.hpp"%(name) fout = os.path.join(path, filename) @@ -361,6 +361,6 @@ def generate_common(path, section, namespace, tags, version, specs, meta): os.makedirs(layer_dstpath, exist_ok=True) loc = 0 - loc += _mako_params_hpp(layer_dstpath, namespace, tags, version, specs, meta) + loc += _mako_print_hpp(layer_dstpath, namespace, tags, version, specs, meta) print("COMMON Generated %s lines of code.\n"%loc) diff --git a/scripts/templates/params.hpp.mako b/scripts/templates/print.hpp.mako similarity index 84% rename from scripts/templates/params.hpp.mako rename to scripts/templates/print.hpp.mako index 42fbf61d1f..ddf17dff29 100644 --- a/scripts/templates/params.hpp.mako +++ b/scripts/templates/print.hpp.mako @@ -18,8 +18,8 @@ from templates import helper as th * @file ${name}.hpp * */ -#ifndef ${X}_PARAMS_HPP -#define ${X}_PARAMS_HPP 1 +#ifndef ${X}_PRINT_HPP +#define ${X}_PRINT_HPP 1 #include "${x}_api.h" #include @@ -27,15 +27,15 @@ from templates import helper as th <%def name="member(iname, itype, loop)"> %if iname == "pNext": - ${x}_params::serializeStruct(os, ${caller.body()}); + ${x}_print::printStruct(os, ${caller.body()}); %elif th.type_traits.is_flags(itype): - ${x}_params::serializeFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); + ${x}_print::printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); %elif not loop and th.type_traits.is_pointer(itype): - ${x}_params::serializePtr(os, ${caller.body()}); + ${x}_print::printPtr(os, ${caller.body()}); %elif loop and th.type_traits.is_pointer_to_pointer(itype): - ${x}_params::serializePtr(os, ${caller.body()}); + ${x}_print::printPtr(os, ${caller.body()}); %elif th.type_traits.is_handle(itype): - ${x}_params::serializePtr(os, ${caller.body()}); + ${x}_print::printPtr(os, ${caller.body()}); %elif iname and iname.startswith("pfn"): os << reinterpret_cast(${caller.body()}); %else: @@ -83,7 +83,7 @@ def findMemberType(_item): os << "}"; %elif findMemberType(item) is not None and findMemberType(item)['type'] == "union": os << ".${iname} = "; - ${x}_params::serializeUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); + ${x}_print::printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); %elif th.type_traits.is_array(item['type']): os << ".${iname} = {"; for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){ @@ -97,7 +97,7 @@ def findMemberType(_item): os << "}"; %elif typename is not None: os << ".${iname} = "; - ${x}_params::serializeTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); + ${x}_print::printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); %else: os << ".${iname} = "; <%call expr="member(iname, itype, False)"> @@ -106,7 +106,7 @@ def findMemberType(_item): %endif -namespace ${x}_params { +namespace ${x}_print { template struct is_handle : std::false_type {}; %for spec in specs: %for obj in spec['objects']: @@ -117,24 +117,24 @@ template <> struct is_handle<${th.make_type_name(n, tags, obj)}> : std::true_typ %endfor template inline constexpr bool is_handle_v = is_handle::value; -template inline void serializePtr(std::ostream &os, const T *ptr); -template inline void serializeFlag(std::ostream &os, uint32_t flag); -template inline void serializeTagged(std::ostream &os, const void *ptr, T value, size_t size); +template inline void printPtr(std::ostream &os, const T *ptr); +template inline void printFlag(std::ostream &os, uint32_t flag); +template inline void printTagged(std::ostream &os, const void *ptr, T value, size_t size); %for spec in specs: %for obj in spec['objects']: ## ENUM ####################################################################### %if re.match(r"enum", obj['type']): %if obj.get('typed_etors', False) is True: - template <> inline void serializeTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size); + template <> inline void printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size); %elif "structure_type" in obj['name']: - inline void serializeStruct(std::ostream &os, const void *ptr); + inline void printStruct(std::ostream &os, const void *ptr); %endif %endif %if re.match(r"union", obj['type']) and obj['name']: <% tag = [_obj for _s in specs for _obj in _s['objects'] if _obj['name'] == obj['tag']][0] %> - inline void serializeUnion( + inline void printUnion( std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params, const ${tag['type']} ${th.make_type_name(n, tags, tag)} tag @@ -143,11 +143,11 @@ template inline void serializeTagged(std::ostream &os, const void * %if th.type_traits.is_flags(obj['name']): - template<> inline void serializeFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag); + template<> inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag); %endif %endfor # obj in spec['objects'] %endfor -} // namespace ${x}_params +} // namespace ${x}_print %for spec in specs: %for obj in spec['objects']: @@ -188,11 +188,11 @@ template inline void serializeTagged(std::ostream &os, const void * } %endif %if obj.get('typed_etors', False) is True: - namespace ${x}_params { + namespace ${x}_print { template <> - inline void serializeTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size) { + inline void printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -211,7 +211,7 @@ template inline void serializeTagged(std::ostream &os, const void * const ${atype} *tptr = (const ${atype} *)ptr; %endif %if "char" in atype: ## print char* arrays as simple NULL-terminated strings - serializePtr(os, tptr); + printPtr(os, tptr); %else: os << "{"; size_t nelems = size / sizeof(${atype}); @@ -250,10 +250,10 @@ template inline void serializeTagged(std::ostream &os, const void * } } %elif "structure_type" in obj['name']: - namespace ${x}_params { - inline void serializeStruct(std::ostream &os, const void *ptr) { + namespace ${x}_print { + inline void printStruct(std::ostream &os, const void *ptr) { if (ptr == NULL) { - ${x}_params::serializePtr(os, ptr); + ${x}_print::printPtr(os, ptr); return; } @@ -266,7 +266,7 @@ template inline void serializeTagged(std::ostream &os, const void * %> case ${ename}: { const ${th.subt(n, tags, item['desc'])} *pstruct = (const ${th.subt(n, tags, item['desc'])} *)ptr; - ${x}_params::serializePtr(os, pstruct); + ${x}_print::printPtr(os, pstruct); } break; %endfor default: @@ -274,13 +274,13 @@ template inline void serializeTagged(std::ostream &os, const void * break; } } - } // namespace ${x}_params + } // namespace ${x}_print %endif %if th.type_traits.is_flags(obj['name']): -namespace ${x}_params { +namespace ${x}_print { template<> -inline void serializeFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag) { +inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; %for n, item in enumerate(obj['etors']): @@ -310,7 +310,7 @@ inline void serializeFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, os << "0"; } } -} // namespace ${x}_params +} // namespace ${x}_print %endif ## STRUCT/UNION ############################################################### %elif re.match(r"struct", obj['type']): @@ -332,7 +332,7 @@ inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make } %elif re.match(r"union", obj['type']) and obj['name']: <% tag = findUnionTag(obj) %> -inline void ${x}_params::serializeUnion( +inline void ${x}_print::printUnion( std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params, const ${tag['type']} ${th.make_type_name(n, tags, tag)} tag @@ -381,14 +381,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct %endfor %endfor -namespace ${x}_params { +namespace ${x}_print { -template inline void serializePtr(std::ostream &os, const T *ptr) { +template inline void printPtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; } else if constexpr (std::is_pointer_v) { os << (const void *)(ptr) << " ("; - serializePtr(os, *ptr); + printPtr(os, *ptr); os << ")"; } else if constexpr (std::is_void_v || is_handle_v) { os << (const void *)ptr; @@ -403,7 +403,7 @@ template inline void serializePtr(std::ostream &os, const T *ptr) { } } -inline int serializeFunctionParams(std::ostream &os, uint32_t function, const void *params) { +inline int printFunctionParams(std::ostream &os, uint32_t function, const void *params) { switch((enum ${x}_function_t)function) { %for tbl in th.get_pfncbtables(specs, meta, n, tags): %for obj in tbl['functions']: @@ -416,6 +416,6 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, const vo } return 0; } -} // namespace ur_params +} // namespace ur_print -#endif /* ${X}_PARAMS_HPP */ +#endif /* ${X}_PRINT_HPP */ diff --git a/source/common/ur_params.hpp b/source/common/ur_print.hpp similarity index 86% rename from source/common/ur_params.hpp rename to source/common/ur_print.hpp index 9d7779ea2d..0f867dcfa3 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_print.hpp @@ -6,17 +6,17 @@ * See LICENSE.TXT * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * - * @file ur_params.hpp + * @file ur_print.hpp * */ -#ifndef UR_PARAMS_HPP -#define UR_PARAMS_HPP 1 +#ifndef UR_PRINT_HPP +#define UR_PRINT_HPP 1 #include "ur_api.h" #include #include -namespace ur_params { +namespace ur_print { template struct is_handle : std::false_type {}; template <> struct is_handle : std::true_type {}; template <> struct is_handle : std::true_type {}; @@ -40,185 +40,177 @@ struct is_handle : std::true_type {}; template <> struct is_handle : std::true_type {}; template inline constexpr bool is_handle_v = is_handle::value; -template inline void serializePtr(std::ostream &os, const T *ptr); +template inline void printPtr(std::ostream &os, const T *ptr); +template inline void printFlag(std::ostream &os, uint32_t flag); template -inline void serializeFlag(std::ostream &os, uint32_t flag); -template -inline void serializeTagged(std::ostream &os, const void *ptr, T value, - size_t size); +inline void printTagged(std::ostream &os, const void *ptr, T value, + size_t size); -inline void serializeStruct(std::ostream &os, const void *ptr); +inline void printStruct(std::ostream &os, const void *ptr); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_loader_config_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_loader_config_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_adapter_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_adapter_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_platform_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_platform_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_device_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_device_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); -inline void serializeUnion(std::ostream &os, - const union ur_device_partition_value_t params, - const enum ur_device_partition_t tag); +inline void printUnion(std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void -serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_context_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_context_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_mem_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, + size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_image_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_image_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_sampler_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_sampler_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_usm_alloc_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_usm_alloc_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_usm_pool_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_usm_pool_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_granularity_info_t value, - size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_granularity_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); -inline void serializeUnion(std::ostream &os, - const union ur_program_metadata_value_t params, - const enum ur_program_metadata_type_t tag); +inline void printUnion(std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_program_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_program_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_program_build_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_program_build_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_group_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_group_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_sub_group_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_sub_group_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_exec_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_exec_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_queue_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_queue_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_event_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_event_info_t value, size_t size); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_profiling_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_profiling_info_t value, size_t size); template <> -inline void serializeFlag(std::ostream &os, uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, uint32_t flag); template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag); +inline void printFlag(std::ostream &os, + uint32_t flag); template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_exp_peer_info_t value, size_t size); +inline void printTagged(std::ostream &os, const void *ptr, + ur_exp_peer_info_t value, size_t size); -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value); inline std::ostream &operator<<(std::ostream &os, @@ -1392,10 +1384,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { -inline void serializeStruct(std::ostream &os, const void *ptr) { +namespace ur_print { +inline void printStruct(std::ostream &os, const void *ptr) { if (ptr == NULL) { - ur_params::serializePtr(os, ptr); + ur_print::printPtr(os, ptr); return; } @@ -1406,252 +1398,252 @@ inline void serializeStruct(std::ostream &os, const void *ptr) { case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: { const ur_context_properties_t *pstruct = (const ur_context_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_IMAGE_DESC: { const ur_image_desc_t *pstruct = (const ur_image_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_PROPERTIES: { const ur_buffer_properties_t *pstruct = (const ur_buffer_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_REGION: { const ur_buffer_region_t *pstruct = (const ur_buffer_region_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES: { const ur_buffer_channel_properties_t *pstruct = (const ur_buffer_channel_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES: { const ur_buffer_alloc_location_properties_t *pstruct = (const ur_buffer_alloc_location_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES: { const ur_program_properties_t *pstruct = (const ur_program_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_DESC: { const ur_usm_desc_t *pstruct = (const ur_usm_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_HOST_DESC: { const ur_usm_host_desc_t *pstruct = (const ur_usm_host_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_DEVICE_DESC: { const ur_usm_device_desc_t *pstruct = (const ur_usm_device_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_POOL_DESC: { const ur_usm_pool_desc_t *pstruct = (const ur_usm_pool_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC: { const ur_usm_pool_limits_desc_t *pstruct = (const ur_usm_pool_limits_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_BINARY: { const ur_device_binary_t *pstruct = (const ur_device_binary_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_SAMPLER_DESC: { const ur_sampler_desc_t *pstruct = (const ur_sampler_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_PROPERTIES: { const ur_queue_properties_t *pstruct = (const ur_queue_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES: { const ur_queue_index_properties_t *pstruct = (const ur_queue_index_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES: { const ur_context_native_properties_t *pstruct = (const ur_context_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES: { const ur_kernel_native_properties_t *pstruct = (const ur_kernel_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES: { const ur_queue_native_properties_t *pstruct = (const ur_queue_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES: { const ur_mem_native_properties_t *pstruct = (const ur_mem_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES: { const ur_event_native_properties_t *pstruct = (const ur_event_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES: { const ur_platform_native_properties_t *pstruct = (const ur_platform_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES: { const ur_device_native_properties_t *pstruct = (const ur_device_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES: { const ur_program_native_properties_t *pstruct = (const ur_program_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES: { const ur_sampler_native_properties_t *pstruct = (const ur_sampler_native_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC: { const ur_queue_native_desc_t *pstruct = (const ur_queue_native_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES: { const ur_device_partition_properties_t *pstruct = (const ur_device_partition_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES: { const ur_kernel_arg_mem_obj_properties_t *pstruct = (const ur_kernel_arg_mem_obj_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES: { const ur_physical_mem_properties_t *pstruct = (const ur_physical_mem_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES: { const ur_kernel_arg_pointer_properties_t *pstruct = (const ur_kernel_arg_pointer_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES: { const ur_kernel_arg_sampler_properties_t *pstruct = (const ur_kernel_arg_sampler_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES: { const ur_kernel_exec_info_properties_t *pstruct = (const ur_kernel_exec_info_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES: { const ur_kernel_arg_value_properties_t *pstruct = (const ur_kernel_arg_value_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: { const ur_kernel_arg_local_properties_t *pstruct = (const ur_kernel_arg_local_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: { const ur_exp_command_buffer_desc_t *pstruct = (const ur_exp_command_buffer_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES: { const ur_exp_sampler_mip_properties_t *pstruct = (const ur_exp_sampler_mip_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC: { const ur_exp_interop_mem_desc_t *pstruct = (const ur_exp_interop_mem_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC: { const ur_exp_interop_semaphore_desc_t *pstruct = (const ur_exp_interop_semaphore_desc_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR: { const ur_exp_file_descriptor_t *pstruct = (const ur_exp_file_descriptor_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: { const ur_exp_win32_handle_t *pstruct = (const ur_exp_win32_handle_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: { const ur_exp_layered_image_properties_t *pstruct = (const ur_exp_layered_image_properties_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: { const ur_exp_sampler_addr_modes_t *pstruct = (const ur_exp_sampler_addr_modes_t *)ptr; - ur_params::serializePtr(os, pstruct); + ur_print::printPtr(os, pstruct); } break; default: os << "unknown enumerator"; break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) { switch (value) { @@ -1963,7 +1955,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -1979,7 +1971,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -2055,11 +2047,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -2123,7 +2114,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_loader_config_info_t value) { switch (value) { @@ -2141,12 +2132,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_loader_config_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_loader_config_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -2155,7 +2146,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_LOADER_CONFIG_INFO_REFERENCE_COUNT: { @@ -2176,7 +2167,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_code_location_t params) { os << "(struct ur_code_location_t){"; @@ -2220,12 +2211,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_adapter_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_adapter_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -2263,7 +2254,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_backend_t value) { switch (value) { @@ -2330,12 +2321,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_platform_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_platform_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -2344,31 +2335,31 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_PLATFORM_INFO_NAME: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PLATFORM_INFO_VENDOR_NAME: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PLATFORM_INFO_VERSION: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PLATFORM_INFO_EXTENSIONS: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PLATFORM_INFO_PROFILE: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PLATFORM_INFO_BACKEND: { @@ -2389,7 +2380,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value) { os << UR_MAJOR_VERSION(value) << "." << UR_MINOR_VERSION(value); return os; @@ -2406,7 +2397,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -2460,12 +2451,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".pDeviceTargetSpec = "; - ur_params::serializePtr(os, (params.pDeviceTargetSpec)); + ur_print::printPtr(os, (params.pDeviceTargetSpec)); os << "}"; return os; @@ -3042,12 +3033,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_device_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_device_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -3163,7 +3154,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3179,7 +3170,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3195,7 +3186,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3209,7 +3200,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3899,7 +3890,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3913,7 +3904,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3927,7 +3918,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -3935,7 +3926,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_DEVICE_INFO_BUILT_IN_KERNELS: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_PLATFORM: { @@ -3947,7 +3938,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -3969,49 +3960,49 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_DEVICE_INFO_IL_VERSION: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_NAME: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_VENDOR: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_DRIVER_VERSION: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_PROFILE: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_VERSION: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_EXTENSIONS: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE: { @@ -4051,7 +4042,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -4096,7 +4087,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4170,8 +4161,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, - *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4186,8 +4176,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, - *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4202,8 +4191,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, - *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4218,8 +4206,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, - *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4234,8 +4221,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, - *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4243,13 +4229,13 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_DEVICE_INFO_UUID: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_PCI_ADDRESS: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_DEVICE_INFO_GPU_EU_COUNT: { @@ -4403,7 +4389,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4419,7 +4405,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4435,7 +4421,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4451,7 +4437,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -4853,7 +4839,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_device_affinity_domain_flag_t value) { switch (value) { @@ -4887,11 +4873,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -4970,7 +4956,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_device_partition_t value) { switch (value) { @@ -4997,10 +4983,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline void -ur_params::serializeUnion(std::ostream &os, - const union ur_device_partition_value_t params, - const enum ur_device_partition_t tag) { +inline void ur_print::printUnion(std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag) { os << "(union ur_device_partition_value_t){"; switch (tag) { @@ -5022,7 +5007,7 @@ ur_params::serializeUnion(std::ostream &os, os << ".affinity_domain = "; - ur_params::serializeFlag( + ur_print::printFlag( os, (params.affinity_domain)); break; @@ -5043,7 +5028,7 @@ operator<<(std::ostream &os, os << ", "; os << ".value = "; - ur_params::serializeUnion(os, (params.value), params.type); + ur_print::printUnion(os, (params.value), params.type); os << "}"; return os; @@ -5060,12 +5045,12 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, (params.pProperties)); + ur_print::printPtr(os, (params.pProperties)); os << ", "; os << ".PropCount = "; @@ -5116,11 +5101,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5222,7 +5207,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_device_mem_cache_type_t value) { switch (value) { @@ -5282,11 +5267,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5321,7 +5306,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_device_native_properties_t params) { @@ -5334,7 +5319,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5373,11 +5358,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5445,7 +5430,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_memory_scope_capability_flag_t value) { switch (value) { @@ -5475,11 +5460,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5547,7 +5532,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, enum ur_device_usm_access_capability_flag_t value) { @@ -5574,12 +5559,11 @@ operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void -serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5638,7 +5622,7 @@ serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_context_flag_t value) { switch (value) { @@ -5652,10 +5636,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5678,7 +5662,7 @@ inline void serializeFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_context_properties_t params) { os << "(struct ur_context_properties_t){"; @@ -5690,12 +5674,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, (params.flags)); + ur_print::printFlag(os, (params.flags)); os << "}"; return os; @@ -5745,12 +5729,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_context_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_context_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -5780,7 +5764,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, os << ", "; } - ur_params::serializePtr(os, tptr[i]); + ur_print::printPtr(os, tptr[i]); } os << "}"; } break; @@ -5838,7 +5822,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -5854,7 +5838,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -5870,7 +5854,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -5886,7 +5870,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -5895,7 +5879,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_context_native_properties_t params) { @@ -5908,7 +5892,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5950,10 +5934,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -6029,7 +6013,7 @@ inline void serializeFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { switch (value) { @@ -6082,12 +6066,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_mem_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, + size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -6116,7 +6100,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -6125,7 +6109,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_image_channel_order_t value) { switch (value) { @@ -6300,12 +6284,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_image_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_image_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -6413,7 +6397,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_image_format_t params) { os << "(struct ur_image_format_t){"; @@ -6441,7 +6425,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".type = "; @@ -6502,12 +6486,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".pHost = "; - ur_params::serializePtr(os, (params.pHost)); + ur_print::printPtr(os, (params.pHost)); os << "}"; return os; @@ -6524,7 +6508,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".channel = "; @@ -6546,7 +6530,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".location = "; @@ -6567,7 +6551,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".origin = "; @@ -6606,7 +6590,7 @@ operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -6691,12 +6675,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_sampler_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_sampler_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -6725,7 +6709,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -6779,7 +6763,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_sampler_desc_t params) { os << "(struct ur_sampler_desc_t){"; @@ -6791,7 +6775,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".normalizedCoords = "; @@ -6823,7 +6807,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -6846,11 +6830,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -6874,7 +6857,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_device_mem_flag_t value) { switch (value) { @@ -6896,11 +6879,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -6946,7 +6929,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_pool_flag_t value) { switch (value) { @@ -6960,10 +6943,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -6987,7 +6970,7 @@ inline void serializeFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value) { switch (value) { @@ -7041,12 +7024,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_usm_alloc_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_usm_alloc_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -7103,7 +7086,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -7117,7 +7100,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -7126,7 +7109,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_advice_flag_t value) { switch (value) { @@ -7196,11 +7179,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -7378,7 +7360,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_desc_t params) { os << "(struct ur_usm_desc_t){"; @@ -7390,12 +7372,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".hints = "; - ur_params::serializeFlag(os, (params.hints)); + ur_print::printFlag(os, (params.hints)); os << ", "; os << ".align = "; @@ -7416,12 +7398,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, (params.flags)); + ur_print::printFlag(os, (params.flags)); os << "}"; return os; @@ -7437,12 +7419,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, (params.flags)); + ur_print::printFlag(os, (params.flags)); os << "}"; return os; @@ -7458,12 +7440,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, (params.flags)); + ur_print::printFlag(os, (params.flags)); os << "}"; return os; @@ -7479,7 +7461,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".maxPoolableSize = "; @@ -7511,12 +7493,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_usm_pool_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_usm_pool_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -7545,7 +7527,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -7554,7 +7536,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_granularity_info_t value) { switch (value) { @@ -7572,13 +7554,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_granularity_info_t value, - size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_granularity_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -7616,7 +7597,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_access_flag_t value) { switch (value) { @@ -7638,11 +7619,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -7688,7 +7669,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_info_t value) { switch (value) { @@ -7702,12 +7683,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_virtual_mem_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -7724,7 +7705,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -7733,7 +7714,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_flag_t value) { switch (value) { @@ -7747,11 +7728,10 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -7775,7 +7755,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { os << "(struct ur_physical_mem_properties_t){"; @@ -7787,12 +7767,12 @@ operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, (params.flags)); + ur_print::printFlag(os, (params.flags)); os << "}"; return os; @@ -7823,10 +7803,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline void -ur_params::serializeUnion(std::ostream &os, - const union ur_program_metadata_value_t params, - const enum ur_program_metadata_type_t tag) { +inline void ur_print::printUnion(std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag) { os << "(union ur_program_metadata_value_t){"; switch (tag) { @@ -7848,14 +7827,14 @@ ur_params::serializeUnion(std::ostream &os, os << ".pString = "; - ur_params::serializePtr(os, (params.pString)); + ur_print::printPtr(os, (params.pString)); break; case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: os << ".pData = "; - ur_params::serializePtr(os, (params.pData)); + ur_print::printPtr(os, (params.pData)); break; default: @@ -7870,7 +7849,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ".pName = "; - ur_params::serializePtr(os, (params.pName)); + ur_print::printPtr(os, (params.pName)); os << ", "; os << ".type = "; @@ -7884,7 +7863,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".value = "; - ur_params::serializeUnion(os, (params.value), params.type); + ur_print::printUnion(os, (params.value), params.type); os << "}"; return os; @@ -7900,7 +7879,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".count = "; @@ -7966,12 +7945,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_program_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_program_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8000,7 +7979,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -8029,7 +8008,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, os << ", "; } - ur_params::serializePtr(os, tptr[i]); + ur_print::printPtr(os, tptr[i]); } os << "}"; } break; @@ -8037,7 +8016,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_PROGRAM_INFO_SOURCE: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PROGRAM_INFO_BINARY_SIZES: { @@ -8058,7 +8037,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_PROGRAM_INFO_BINARIES: { const unsigned char *tptr = (const unsigned char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PROGRAM_INFO_NUM_KERNELS: { @@ -8078,14 +8057,14 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_PROGRAM_INFO_KERNEL_NAMES: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; default: os << "unknown enumerator"; break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_program_build_status_t value) { switch (value) { @@ -8161,12 +8140,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_program_build_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_program_build_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8190,13 +8169,13 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_PROGRAM_BUILD_INFO_OPTIONS: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PROGRAM_BUILD_INFO_LOG: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_PROGRAM_BUILD_INFO_BINARY_TYPE: { @@ -8218,7 +8197,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_specialization_constant_info_t params) { @@ -8236,7 +8215,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pValue = "; - ur_params::serializePtr(os, (params.pValue)); + ur_print::printPtr(os, (params.pValue)); os << "}"; return os; @@ -8253,7 +8232,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8275,7 +8254,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -8292,7 +8271,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -8333,12 +8312,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8347,7 +8326,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_KERNEL_INFO_FUNCTION_NAME: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_KERNEL_INFO_NUM_ARGS: { @@ -8387,7 +8366,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -8401,7 +8380,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -8409,7 +8388,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_KERNEL_INFO_ATTRIBUTES: { const char *tptr = (const char *)ptr; - serializePtr(os, tptr); + printPtr(os, tptr); } break; case UR_KERNEL_INFO_NUM_REGS: { @@ -8430,7 +8409,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_group_info_t value) { switch (value) { @@ -8464,12 +8443,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_group_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_group_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8565,7 +8544,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_sub_group_info_t value) { switch (value) { @@ -8591,12 +8570,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_sub_group_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_sub_group_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8662,7 +8641,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_cache_config_t value) { switch (value) { @@ -8705,12 +8684,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_kernel_exec_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_kernel_exec_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8764,7 +8743,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_kernel_arg_pointer_properties_t params) { @@ -8777,7 +8756,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -8794,7 +8773,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -8811,7 +8790,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -8828,12 +8807,12 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".memoryAccess = "; - ur_params::serializeFlag(os, (params.memoryAccess)); + ur_print::printFlag(os, (params.memoryAccess)); os << "}"; return os; @@ -8850,7 +8829,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8896,12 +8875,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_queue_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_queue_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -8916,7 +8895,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -8930,7 +8909,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -8944,7 +8923,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -8958,7 +8937,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializeFlag(os, *tptr); + ur_print::printFlag(os, *tptr); os << ")"; } break; @@ -9009,7 +8988,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { switch (value) { @@ -9062,10 +9041,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -9198,7 +9177,7 @@ inline void serializeFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_properties_t params) { os << "(struct ur_queue_properties_t){"; @@ -9210,12 +9189,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, (params.flags)); + ur_print::printFlag(os, (params.flags)); os << "}"; return os; @@ -9231,7 +9210,7 @@ operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".computeIndex = "; @@ -9252,12 +9231,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".pNativeData = "; - ur_params::serializePtr(os, (params.pNativeData)); + ur_print::printPtr(os, (params.pNativeData)); os << "}"; return os; @@ -9273,7 +9252,7 @@ operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -9456,12 +9435,12 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_event_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_event_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -9476,7 +9455,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -9490,7 +9469,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_params::serializePtr(os, *tptr); + ur_print::printPtr(os, *tptr); os << ")"; } break; @@ -9541,7 +9520,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_profiling_info_t value) { switch (value) { @@ -9571,12 +9550,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_profiling_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_profiling_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -9656,7 +9635,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << "(struct ur_event_native_properties_t){"; @@ -9668,7 +9647,7 @@ operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -9723,10 +9702,10 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value) { } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, uint32_t flag) { +inline void printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -9770,7 +9749,7 @@ inline void serializeFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_migration_flag_t value) { switch (value) { @@ -9784,11 +9763,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -9812,7 +9791,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_exp_image_copy_flag_t value) { switch (value) { @@ -9834,11 +9813,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeFlag(std::ostream &os, - uint32_t flag) { +inline void printFlag(std::ostream &os, + uint32_t flag) { uint32_t val = flag; bool first = true; @@ -9884,7 +9863,7 @@ inline void serializeFlag(std::ostream &os, os << "0"; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_file_descriptor_t params) { os << "(struct ur_exp_file_descriptor_t){"; @@ -9896,7 +9875,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".fd = "; @@ -9917,12 +9896,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".handle = "; - ur_params::serializePtr(os, (params.handle)); + ur_print::printPtr(os, (params.handle)); os << "}"; return os; @@ -9939,7 +9918,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".minMipmapLevelClamp = "; @@ -9975,7 +9954,7 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".addrModes = {"; @@ -10002,7 +9981,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -10019,7 +9998,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -10036,7 +10015,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << ", "; os << ".numLayers = "; @@ -10057,7 +10036,7 @@ operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { os << ", "; os << ".pNext = "; - ur_params::serializeStruct(os, (params.pNext)); + ur_print::printStruct(os, (params.pNext)); os << "}"; return os; @@ -10079,12 +10058,12 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_params { +namespace ur_print { template <> -inline void serializeTagged(std::ostream &os, const void *ptr, - ur_exp_peer_info_t value, size_t size) { +inline void printTagged(std::ostream &os, const void *ptr, + ur_exp_peer_info_t value, size_t size) { if (ptr == NULL) { - serializePtr(os, ptr); + printPtr(os, ptr); return; } @@ -10122,7 +10101,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_params +} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, @@ -10140,14 +10119,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphAdapters))[i]); + ur_print::printPtr(os, (*(params->pphAdapters))[i]); } os << "}"; os << ", "; os << ".pNumAdapters = "; - ur_params::serializePtr(os, *(params->ppNumAdapters)); + ur_print::printPtr(os, *(params->ppNumAdapters)); return os; } @@ -10158,7 +10137,7 @@ operator<<(std::ostream &os, os << ".hAdapter = "; - ur_params::serializePtr(os, *(params->phAdapter)); + ur_print::printPtr(os, *(params->phAdapter)); return os; } @@ -10169,7 +10148,7 @@ operator<<(std::ostream &os, os << ".hAdapter = "; - ur_params::serializePtr(os, *(params->phAdapter)); + ur_print::printPtr(os, *(params->phAdapter)); return os; } @@ -10180,17 +10159,17 @@ inline std::ostream &operator<<( os << ".hAdapter = "; - ur_params::serializePtr(os, *(params->phAdapter)); + ur_print::printPtr(os, *(params->phAdapter)); os << ", "; os << ".ppMessage = "; - ur_params::serializePtr(os, *(params->pppMessage)); + ur_print::printPtr(os, *(params->pppMessage)); os << ", "; os << ".pError = "; - ur_params::serializePtr(os, *(params->ppError)); + ur_print::printPtr(os, *(params->ppError)); return os; } @@ -10201,7 +10180,7 @@ operator<<(std::ostream &os, os << ".hAdapter = "; - ur_params::serializePtr(os, *(params->phAdapter)); + ur_print::printPtr(os, *(params->phAdapter)); os << ", "; os << ".propName = "; @@ -10215,13 +10194,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -10232,17 +10211,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hImage = "; - ur_params::serializePtr(os, *(params->phImage)); + ur_print::printPtr(os, *(params->phImage)); return os; } @@ -10253,17 +10232,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hImage = "; - ur_params::serializePtr(os, *(params->phImage)); + ur_print::printPtr(os, *(params->phImage)); return os; } @@ -10275,27 +10254,27 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".phImageMem = "; - ur_params::serializePtr(os, *(params->pphImageMem)); + ur_print::printPtr(os, *(params->pphImageMem)); return os; } @@ -10307,17 +10286,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_params::serializePtr(os, *(params->phImageMem)); + ur_print::printPtr(os, *(params->phImageMem)); return os; } @@ -10328,37 +10307,37 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_params::serializePtr(os, *(params->phImageMem)); + ur_print::printPtr(os, *(params->phImageMem)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".phMem = "; - ur_params::serializePtr(os, *(params->pphMem)); + ur_print::printPtr(os, *(params->pphMem)); os << ", "; os << ".phImage = "; - ur_params::serializePtr(os, *(params->pphImage)); + ur_print::printPtr(os, *(params->pphImage)); return os; } @@ -10369,42 +10348,42 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_params::serializePtr(os, *(params->phImageMem)); + ur_print::printPtr(os, *(params->phImageMem)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".hSampler = "; - ur_params::serializePtr(os, *(params->phSampler)); + ur_print::printPtr(os, *(params->phSampler)); os << ", "; os << ".phMem = "; - ur_params::serializePtr(os, *(params->pphMem)); + ur_print::printPtr(os, *(params->pphMem)); os << ", "; os << ".phImage = "; - ur_params::serializePtr(os, *(params->pphImage)); + ur_print::printPtr(os, *(params->pphImage)); return os; } @@ -10416,33 +10395,33 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".imageCopyFlags = "; - ur_params::serializeFlag( - os, *(params->pimageCopyFlags)); + ur_print::printFlag(os, + *(params->pimageCopyFlags)); os << ", "; os << ".srcOffset = "; @@ -10478,14 +10457,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -10497,7 +10476,7 @@ inline std::ostream &operator<<( os << ".hImageMem = "; - ur_params::serializePtr(os, *(params->phImageMem)); + ur_print::printPtr(os, *(params->phImageMem)); os << ", "; os << ".propName = "; @@ -10507,12 +10486,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializePtr(os, *(params->ppPropValue)); + ur_print::printPtr(os, *(params->ppPropValue)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -10523,17 +10502,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_params::serializePtr(os, *(params->phImageMem)); + ur_print::printPtr(os, *(params->phImageMem)); os << ", "; os << ".mipmapLevel = "; @@ -10543,7 +10522,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".phImageMem = "; - ur_params::serializePtr(os, *(params->pphImageMem)); + ur_print::printPtr(os, *(params->pphImageMem)); return os; } @@ -10555,17 +10534,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hMem = "; - ur_params::serializePtr(os, *(params->phMem)); + ur_print::printPtr(os, *(params->phMem)); return os; } @@ -10576,12 +10555,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -10591,12 +10570,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pInteropMemDesc = "; - ur_params::serializePtr(os, *(params->ppInteropMemDesc)); + ur_print::printPtr(os, *(params->ppInteropMemDesc)); os << ", "; os << ".phInteropMem = "; - ur_params::serializePtr(os, *(params->pphInteropMem)); + ur_print::printPtr(os, *(params->pphInteropMem)); return os; } @@ -10607,32 +10586,32 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".hInteropMem = "; - ur_params::serializePtr(os, *(params->phInteropMem)); + ur_print::printPtr(os, *(params->phInteropMem)); os << ", "; os << ".phImageMem = "; - ur_params::serializePtr(os, *(params->pphImageMem)); + ur_print::printPtr(os, *(params->pphImageMem)); return os; } @@ -10643,17 +10622,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hInteropMem = "; - ur_params::serializePtr(os, *(params->phInteropMem)); + ur_print::printPtr(os, *(params->phInteropMem)); return os; } @@ -10665,22 +10644,22 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pInteropSemaphoreDesc = "; - ur_params::serializePtr(os, *(params->ppInteropSemaphoreDesc)); + ur_print::printPtr(os, *(params->ppInteropSemaphoreDesc)); os << ", "; os << ".phInteropSemaphore = "; - ur_params::serializePtr(os, *(params->pphInteropSemaphore)); + ur_print::printPtr(os, *(params->pphInteropSemaphore)); return os; } @@ -10691,17 +10670,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hInteropSemaphore = "; - ur_params::serializePtr(os, *(params->phInteropSemaphore)); + ur_print::printPtr(os, *(params->phInteropSemaphore)); return os; } @@ -10712,12 +10691,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hSemaphore = "; - ur_params::serializePtr(os, *(params->phSemaphore)); + ur_print::printPtr(os, *(params->phSemaphore)); os << ", "; os << ".numEventsInWaitList = "; @@ -10733,14 +10712,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -10751,12 +10730,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hSemaphore = "; - ur_params::serializePtr(os, *(params->phSemaphore)); + ur_print::printPtr(os, *(params->phSemaphore)); os << ", "; os << ".numEventsInWaitList = "; @@ -10772,14 +10751,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -10791,22 +10770,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pCommandBufferDesc = "; - ur_params::serializePtr(os, *(params->ppCommandBufferDesc)); + ur_print::printPtr(os, *(params->ppCommandBufferDesc)); os << ", "; os << ".phCommandBuffer = "; - ur_params::serializePtr(os, *(params->pphCommandBuffer)); + ur_print::printPtr(os, *(params->pphCommandBuffer)); return os; } @@ -10818,7 +10797,7 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); return os; } @@ -10830,7 +10809,7 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); return os; } @@ -10842,7 +10821,7 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); return os; } @@ -10853,12 +10832,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -10868,17 +10847,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - ur_params::serializePtr(os, *(params->ppGlobalWorkOffset)); + ur_print::printPtr(os, *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - ur_params::serializePtr(os, *(params->ppGlobalWorkSize)); + ur_print::printPtr(os, *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - ur_params::serializePtr(os, *(params->ppLocalWorkSize)); + ur_print::printPtr(os, *(params->ppLocalWorkSize)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -10888,12 +10867,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -10904,17 +10883,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".size = "; @@ -10929,12 +10908,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -10946,17 +10925,17 @@ inline std::ostream &operator<<( os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".pMemory = "; - ur_params::serializePtr(os, *(params->ppMemory)); + ur_print::printPtr(os, *(params->ppMemory)); os << ", "; os << ".pPattern = "; - ur_params::serializePtr(os, *(params->ppPattern)); + ur_print::printPtr(os, *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -10976,12 +10955,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -10992,17 +10971,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hSrcMem = "; - ur_params::serializePtr(os, *(params->phSrcMem)); + ur_print::printPtr(os, *(params->phSrcMem)); os << ", "; os << ".hDstMem = "; - ur_params::serializePtr(os, *(params->phDstMem)); + ur_print::printPtr(os, *(params->phDstMem)); os << ", "; os << ".srcOffset = "; @@ -11027,12 +11006,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11043,12 +11022,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".offset = "; @@ -11063,7 +11042,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11073,12 +11052,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11089,12 +11068,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".offset = "; @@ -11109,7 +11088,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11119,12 +11098,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11135,17 +11114,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hSrcMem = "; - ur_params::serializePtr(os, *(params->phSrcMem)); + ur_print::printPtr(os, *(params->phSrcMem)); os << ", "; os << ".hDstMem = "; - ur_params::serializePtr(os, *(params->phDstMem)); + ur_print::printPtr(os, *(params->phDstMem)); os << ", "; os << ".srcOrigin = "; @@ -11190,12 +11169,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11206,12 +11185,12 @@ inline std::ostream &operator<<( os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".bufferOffset = "; @@ -11251,7 +11230,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11261,12 +11240,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11277,12 +11256,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".bufferOffset = "; @@ -11322,7 +11301,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11332,12 +11311,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11348,17 +11327,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".pPattern = "; - ur_params::serializePtr(os, *(params->ppPattern)); + ur_print::printPtr(os, *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -11383,12 +11362,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + ur_print::printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + ur_print::printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11482,12 +11461,12 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + ur_print::printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11503,14 +11482,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -11531,19 +11510,19 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphDevices))[i]); + ur_print::printPtr(os, (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phContext = "; - ur_params::serializePtr(os, *(params->pphContext)); + ur_print::printPtr(os, *(params->pphContext)); return os; } @@ -11554,7 +11533,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); return os; } @@ -11565,7 +11544,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); return os; } @@ -11576,7 +11555,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".propName = "; @@ -11590,13 +11569,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -11608,12 +11587,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".phNativeContext = "; - ur_params::serializePtr(os, *(params->pphNativeContext)); + ur_print::printPtr(os, *(params->pphNativeContext)); return os; } @@ -11625,7 +11604,7 @@ inline std::ostream &operator<<( os << ".hNativeContext = "; - ur_params::serializePtr(os, *(params->phNativeContext)); + ur_print::printPtr(os, *(params->phNativeContext)); os << ", "; os << ".numDevices = "; @@ -11640,19 +11619,19 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphDevices))[i]); + ur_print::printPtr(os, (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phContext = "; - ur_params::serializePtr(os, *(params->pphContext)); + ur_print::printPtr(os, *(params->pphContext)); return os; } @@ -11664,7 +11643,7 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pfnDeleter = "; @@ -11674,7 +11653,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pUserData = "; - ur_params::serializePtr(os, *(params->ppUserData)); + ur_print::printPtr(os, *(params->ppUserData)); return os; } @@ -11685,12 +11664,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -11700,17 +11679,17 @@ inline std::ostream &operator<<( os << ", "; os << ".pGlobalWorkOffset = "; - ur_params::serializePtr(os, *(params->ppGlobalWorkOffset)); + ur_print::printPtr(os, *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - ur_params::serializePtr(os, *(params->ppGlobalWorkSize)); + ur_print::printPtr(os, *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - ur_params::serializePtr(os, *(params->ppLocalWorkSize)); + ur_print::printPtr(os, *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -11726,14 +11705,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -11744,7 +11723,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11760,14 +11739,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -11779,7 +11758,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11795,14 +11774,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -11813,12 +11792,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingRead = "; @@ -11838,7 +11817,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11854,14 +11833,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -11873,12 +11852,12 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -11898,7 +11877,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -11914,14 +11893,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -11933,12 +11912,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingRead = "; @@ -11983,7 +11962,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11999,14 +11978,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12018,12 +11997,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -12068,7 +12047,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12084,14 +12063,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12102,17 +12081,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - ur_params::serializePtr(os, *(params->phBufferSrc)); + ur_print::printPtr(os, *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - ur_params::serializePtr(os, *(params->phBufferDst)); + ur_print::printPtr(os, *(params->phBufferDst)); os << ", "; os << ".srcOffset = "; @@ -12143,14 +12122,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12162,17 +12141,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - ur_params::serializePtr(os, *(params->phBufferSrc)); + ur_print::printPtr(os, *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - ur_params::serializePtr(os, *(params->phBufferDst)); + ur_print::printPtr(os, *(params->phBufferDst)); os << ", "; os << ".srcOrigin = "; @@ -12223,14 +12202,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12241,17 +12220,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".pPattern = "; - ur_params::serializePtr(os, *(params->ppPattern)); + ur_print::printPtr(os, *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -12282,14 +12261,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12300,12 +12279,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hImage = "; - ur_params::serializePtr(os, *(params->phImage)); + ur_print::printPtr(os, *(params->phImage)); os << ", "; os << ".blockingRead = "; @@ -12335,7 +12314,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -12351,14 +12330,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12369,12 +12348,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hImage = "; - ur_params::serializePtr(os, *(params->phImage)); + ur_print::printPtr(os, *(params->phImage)); os << ", "; os << ".blockingWrite = "; @@ -12404,7 +12383,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12420,14 +12399,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12438,17 +12417,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hImageSrc = "; - ur_params::serializePtr(os, *(params->phImageSrc)); + ur_print::printPtr(os, *(params->phImageSrc)); os << ", "; os << ".hImageDst = "; - ur_params::serializePtr(os, *(params->phImageDst)); + ur_print::printPtr(os, *(params->phImageDst)); os << ", "; os << ".srcOrigin = "; @@ -12479,14 +12458,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12497,12 +12476,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingMap = "; @@ -12512,7 +12491,7 @@ inline std::ostream &operator<<( os << ", "; os << ".mapFlags = "; - ur_params::serializeFlag(os, *(params->pmapFlags)); + ur_print::printFlag(os, *(params->pmapFlags)); os << ", "; os << ".offset = "; @@ -12538,19 +12517,19 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); os << ", "; os << ".ppRetMap = "; - ur_params::serializePtr(os, *(params->pppRetMap)); + ur_print::printPtr(os, *(params->pppRetMap)); return os; } @@ -12561,17 +12540,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hMem = "; - ur_params::serializePtr(os, *(params->phMem)); + ur_print::printPtr(os, *(params->phMem)); os << ", "; os << ".pMappedPtr = "; - ur_params::serializePtr(os, *(params->ppMappedPtr)); + ur_print::printPtr(os, *(params->ppMappedPtr)); os << ", "; os << ".numEventsInWaitList = "; @@ -12587,14 +12566,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12605,12 +12584,12 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".ptr = "; - ur_params::serializePtr(os, *(params->pptr)); + ur_print::printPtr(os, *(params->pptr)); os << ", "; os << ".patternSize = "; @@ -12620,7 +12599,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pPattern = "; - ur_params::serializePtr(os, *(params->ppPattern)); + ur_print::printPtr(os, *(params->ppPattern)); os << ", "; os << ".size = "; @@ -12641,14 +12620,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12659,7 +12638,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12669,12 +12648,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".size = "; @@ -12695,14 +12674,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12713,12 +12692,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; @@ -12728,7 +12707,7 @@ inline std::ostream &operator<<( os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, *(params->pflags)); + ur_print::printFlag(os, *(params->pflags)); os << ", "; os << ".numEventsInWaitList = "; @@ -12744,14 +12723,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12762,12 +12741,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; @@ -12777,12 +12756,12 @@ inline std::ostream &operator<<( os << ", "; os << ".advice = "; - ur_params::serializeFlag(os, *(params->padvice)); + ur_print::printFlag(os, *(params->padvice)); os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12793,12 +12772,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); os << ", "; os << ".pitch = "; @@ -12813,7 +12792,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pPattern = "; - ur_params::serializePtr(os, *(params->ppPattern)); + ur_print::printPtr(os, *(params->ppPattern)); os << ", "; os << ".width = "; @@ -12839,14 +12818,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12857,7 +12836,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12867,7 +12846,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".dstPitch = "; @@ -12877,7 +12856,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".srcPitch = "; @@ -12908,14 +12887,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12926,17 +12905,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".name = "; - ur_params::serializePtr(os, *(params->pname)); + ur_print::printPtr(os, *(params->pname)); os << ", "; os << ".blockingWrite = "; @@ -12956,7 +12935,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12972,14 +12951,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -12990,17 +12969,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".name = "; - ur_params::serializePtr(os, *(params->pname)); + ur_print::printPtr(os, *(params->pname)); os << ", "; os << ".blockingRead = "; @@ -13020,7 +12999,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -13036,14 +13015,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -13054,17 +13033,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - ur_params::serializePtr(os, *(params->ppipe_symbol)); + ur_print::printPtr(os, *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13074,7 +13053,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_params::serializePtr(os, *(params->ppDst)); + ur_print::printPtr(os, *(params->ppDst)); os << ", "; os << ".size = "; @@ -13095,14 +13074,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -13113,17 +13092,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - ur_params::serializePtr(os, *(params->ppipe_symbol)); + ur_print::printPtr(os, *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13133,7 +13112,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_params::serializePtr(os, *(params->ppSrc)); + ur_print::printPtr(os, *(params->ppSrc)); os << ", "; os << ".size = "; @@ -13154,14 +13133,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -13172,12 +13151,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -13187,17 +13166,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - ur_params::serializePtr(os, *(params->ppGlobalWorkOffset)); + ur_print::printPtr(os, *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - ur_params::serializePtr(os, *(params->ppGlobalWorkSize)); + ur_print::printPtr(os, *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - ur_params::serializePtr(os, *(params->ppLocalWorkSize)); + ur_print::printPtr(os, *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -13213,14 +13192,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -13231,7 +13210,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_params::serializePtr(os, *(params->phEvent)); + ur_print::printPtr(os, *(params->phEvent)); os << ", "; os << ".propName = "; @@ -13245,13 +13224,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13263,7 +13242,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_params::serializePtr(os, *(params->phEvent)); + ur_print::printPtr(os, *(params->phEvent)); os << ", "; os << ".propName = "; @@ -13277,13 +13256,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13304,7 +13283,7 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphEventWaitList))[i]); + ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; @@ -13317,7 +13296,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_params::serializePtr(os, *(params->phEvent)); + ur_print::printPtr(os, *(params->phEvent)); return os; } @@ -13328,7 +13307,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_params::serializePtr(os, *(params->phEvent)); + ur_print::printPtr(os, *(params->phEvent)); return os; } @@ -13339,12 +13318,12 @@ inline std::ostream &operator<<( os << ".hEvent = "; - ur_params::serializePtr(os, *(params->phEvent)); + ur_print::printPtr(os, *(params->phEvent)); os << ", "; os << ".phNativeEvent = "; - ur_params::serializePtr(os, *(params->pphNativeEvent)); + ur_print::printPtr(os, *(params->pphNativeEvent)); return os; } @@ -13356,22 +13335,22 @@ inline std::ostream &operator<<( os << ".hNativeEvent = "; - ur_params::serializePtr(os, *(params->phNativeEvent)); + ur_print::printPtr(os, *(params->phNativeEvent)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phEvent = "; - ur_params::serializePtr(os, *(params->pphEvent)); + ur_print::printPtr(os, *(params->pphEvent)); return os; } @@ -13382,7 +13361,7 @@ inline std::ostream &operator<<( os << ".hEvent = "; - ur_params::serializePtr(os, *(params->phEvent)); + ur_print::printPtr(os, *(params->phEvent)); os << ", "; os << ".execStatus = "; @@ -13397,7 +13376,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pUserData = "; - ur_params::serializePtr(os, *(params->ppUserData)); + ur_print::printPtr(os, *(params->ppUserData)); return os; } @@ -13408,17 +13387,17 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pKernelName = "; - ur_params::serializePtr(os, *(params->ppKernelName)); + ur_print::printPtr(os, *(params->ppKernelName)); os << ", "; os << ".phKernel = "; - ur_params::serializePtr(os, *(params->pphKernel)); + ur_print::printPtr(os, *(params->pphKernel)); return os; } @@ -13429,7 +13408,7 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".propName = "; @@ -13443,13 +13422,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13460,12 +13439,12 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -13479,13 +13458,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13497,12 +13476,12 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -13516,13 +13495,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13533,7 +13512,7 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); return os; } @@ -13544,7 +13523,7 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); return os; } @@ -13556,12 +13535,12 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".phNativeKernel = "; - ur_params::serializePtr(os, *(params->pphNativeKernel)); + ur_print::printPtr(os, *(params->pphNativeKernel)); return os; } @@ -13573,27 +13552,27 @@ inline std::ostream &operator<<( os << ".hNativeKernel = "; - ur_params::serializePtr(os, *(params->phNativeKernel)); + ur_print::printPtr(os, *(params->phNativeKernel)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phKernel = "; - ur_params::serializePtr(os, *(params->pphKernel)); + ur_print::printPtr(os, *(params->pphKernel)); return os; } @@ -13604,7 +13583,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13619,12 +13598,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".pArgValue = "; - ur_params::serializePtr(os, *(params->ppArgValue)); + ur_print::printPtr(os, *(params->ppArgValue)); return os; } @@ -13635,7 +13614,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13650,7 +13629,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); return os; } @@ -13661,7 +13640,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13671,12 +13650,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".pArgValue = "; - ur_params::serializePtr(os, *(params->ppArgValue)); + ur_print::printPtr(os, *(params->ppArgValue)); return os; } @@ -13687,7 +13666,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".propName = "; @@ -13702,12 +13681,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); return os; } @@ -13718,7 +13697,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13728,12 +13707,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".hArgValue = "; - ur_params::serializePtr(os, *(params->phArgValue)); + ur_print::printPtr(os, *(params->phArgValue)); return os; } @@ -13744,7 +13723,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13754,12 +13733,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".hArgValue = "; - ur_params::serializePtr(os, *(params->phArgValue)); + ur_print::printPtr(os, *(params->phArgValue)); return os; } @@ -13770,7 +13749,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".count = "; @@ -13780,7 +13759,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSpecConstants = "; - ur_params::serializePtr(os, *(params->ppSpecConstants)); + ur_print::printPtr(os, *(params->ppSpecConstants)); return os; } @@ -13791,12 +13770,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - ur_params::serializePtr(os, *(params->phKernel)); + ur_print::printPtr(os, *(params->phKernel)); os << ", "; os << ".pGroupCountRet = "; - ur_params::serializePtr(os, *(params->ppGroupCountRet)); + ur_print::printPtr(os, *(params->ppGroupCountRet)); return os; } @@ -13807,13 +13786,12 @@ operator<<(std::ostream &os, os << ".device_flags = "; - ur_params::serializeFlag(os, - *(params->pdevice_flags)); + ur_print::printFlag(os, *(params->pdevice_flags)); os << ", "; os << ".hLoaderConfig = "; - ur_params::serializePtr(os, *(params->phLoaderConfig)); + ur_print::printPtr(os, *(params->phLoaderConfig)); return os; } @@ -13831,7 +13809,7 @@ inline std::ostream &operator<<( os << ".phLoaderConfig = "; - ur_params::serializePtr(os, *(params->pphLoaderConfig)); + ur_print::printPtr(os, *(params->pphLoaderConfig)); return os; } @@ -13842,7 +13820,7 @@ inline std::ostream &operator<<( os << ".hLoaderConfig = "; - ur_params::serializePtr(os, *(params->phLoaderConfig)); + ur_print::printPtr(os, *(params->phLoaderConfig)); return os; } @@ -13853,7 +13831,7 @@ inline std::ostream &operator<<( os << ".hLoaderConfig = "; - ur_params::serializePtr(os, *(params->phLoaderConfig)); + ur_print::printPtr(os, *(params->phLoaderConfig)); return os; } @@ -13864,7 +13842,7 @@ inline std::ostream &operator<<( os << ".hLoaderConfig = "; - ur_params::serializePtr(os, *(params->phLoaderConfig)); + ur_print::printPtr(os, *(params->phLoaderConfig)); os << ", "; os << ".propName = "; @@ -13878,13 +13856,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13896,12 +13874,12 @@ operator<<(std::ostream &os, os << ".hLoaderConfig = "; - ur_params::serializePtr(os, *(params->phLoaderConfig)); + ur_print::printPtr(os, *(params->phLoaderConfig)); os << ", "; os << ".pLayerName = "; - ur_params::serializePtr(os, *(params->ppLayerName)); + ur_print::printPtr(os, *(params->ppLayerName)); return os; } @@ -13933,32 +13911,32 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, *(params->pflags)); + ur_print::printFlag(os, *(params->pflags)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".pHost = "; - ur_params::serializePtr(os, *(params->ppHost)); + ur_print::printPtr(os, *(params->ppHost)); os << ", "; os << ".phMem = "; - ur_params::serializePtr(os, *(params->pphMem)); + ur_print::printPtr(os, *(params->pphMem)); return os; } @@ -13969,12 +13947,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, *(params->pflags)); + ur_print::printFlag(os, *(params->pflags)); os << ", "; os << ".size = "; @@ -13984,12 +13962,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phBuffer = "; - ur_params::serializePtr(os, *(params->pphBuffer)); + ur_print::printPtr(os, *(params->pphBuffer)); return os; } @@ -14000,7 +13978,7 @@ operator<<(std::ostream &os, os << ".hMem = "; - ur_params::serializePtr(os, *(params->phMem)); + ur_print::printPtr(os, *(params->phMem)); return os; } @@ -14011,7 +13989,7 @@ operator<<(std::ostream &os, os << ".hMem = "; - ur_params::serializePtr(os, *(params->phMem)); + ur_print::printPtr(os, *(params->phMem)); return os; } @@ -14022,12 +14000,12 @@ inline std::ostream &operator<<( os << ".hBuffer = "; - ur_params::serializePtr(os, *(params->phBuffer)); + ur_print::printPtr(os, *(params->phBuffer)); os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, *(params->pflags)); + ur_print::printFlag(os, *(params->pflags)); os << ", "; os << ".bufferCreateType = "; @@ -14037,12 +14015,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pRegion = "; - ur_params::serializePtr(os, *(params->ppRegion)); + ur_print::printPtr(os, *(params->ppRegion)); os << ", "; os << ".phMem = "; - ur_params::serializePtr(os, *(params->pphMem)); + ur_print::printPtr(os, *(params->pphMem)); return os; } @@ -14053,12 +14031,12 @@ inline std::ostream &operator<<( os << ".hMem = "; - ur_params::serializePtr(os, *(params->phMem)); + ur_print::printPtr(os, *(params->phMem)); os << ", "; os << ".phNativeMem = "; - ur_params::serializePtr(os, *(params->pphNativeMem)); + ur_print::printPtr(os, *(params->pphNativeMem)); return os; } @@ -14069,22 +14047,22 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeMem = "; - ur_params::serializePtr(os, *(params->phNativeMem)); + ur_print::printPtr(os, *(params->phNativeMem)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phMem = "; - ur_params::serializePtr(os, *(params->pphMem)); + ur_print::printPtr(os, *(params->pphMem)); return os; } @@ -14095,32 +14073,32 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeMem = "; - ur_params::serializePtr(os, *(params->phNativeMem)); + ur_print::printPtr(os, *(params->phNativeMem)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pImageFormat = "; - ur_params::serializePtr(os, *(params->ppImageFormat)); + ur_print::printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_params::serializePtr(os, *(params->ppImageDesc)); + ur_print::printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phMem = "; - ur_params::serializePtr(os, *(params->pphMem)); + ur_print::printPtr(os, *(params->pphMem)); return os; } @@ -14131,7 +14109,7 @@ operator<<(std::ostream &os, os << ".hMemory = "; - ur_params::serializePtr(os, *(params->phMemory)); + ur_print::printPtr(os, *(params->phMemory)); os << ", "; os << ".propName = "; @@ -14145,13 +14123,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14162,7 +14140,7 @@ inline std::ostream &operator<<( os << ".hMemory = "; - ur_params::serializePtr(os, *(params->phMemory)); + ur_print::printPtr(os, *(params->phMemory)); os << ", "; os << ".propName = "; @@ -14176,13 +14154,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14193,12 +14171,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -14208,12 +14186,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phPhysicalMem = "; - ur_params::serializePtr(os, *(params->pphPhysicalMem)); + ur_print::printPtr(os, *(params->pphPhysicalMem)); return os; } @@ -14224,7 +14202,7 @@ inline std::ostream &operator<<( os << ".hPhysicalMem = "; - ur_params::serializePtr(os, *(params->phPhysicalMem)); + ur_print::printPtr(os, *(params->phPhysicalMem)); return os; } @@ -14235,7 +14213,7 @@ inline std::ostream &operator<<( os << ".hPhysicalMem = "; - ur_params::serializePtr(os, *(params->phPhysicalMem)); + ur_print::printPtr(os, *(params->phPhysicalMem)); return os; } @@ -14251,7 +14229,7 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphAdapters))[i]); + ur_print::printPtr(os, (*(params->pphAdapters))[i]); } os << "}"; @@ -14273,14 +14251,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphPlatforms))[i]); + ur_print::printPtr(os, (*(params->pphPlatforms))[i]); } os << "}"; os << ", "; os << ".pNumPlatforms = "; - ur_params::serializePtr(os, *(params->ppNumPlatforms)); + ur_print::printPtr(os, *(params->ppNumPlatforms)); return os; } @@ -14291,7 +14269,7 @@ inline std::ostream &operator<<( os << ".hPlatform = "; - ur_params::serializePtr(os, *(params->phPlatform)); + ur_print::printPtr(os, *(params->phPlatform)); os << ", "; os << ".propName = "; @@ -14305,13 +14283,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14323,12 +14301,12 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_params::serializePtr(os, *(params->phPlatform)); + ur_print::printPtr(os, *(params->phPlatform)); os << ", "; os << ".phNativePlatform = "; - ur_params::serializePtr(os, *(params->pphNativePlatform)); + ur_print::printPtr(os, *(params->pphNativePlatform)); return os; } @@ -14340,17 +14318,17 @@ inline std::ostream &operator<<( os << ".hNativePlatform = "; - ur_params::serializePtr(os, *(params->phNativePlatform)); + ur_print::printPtr(os, *(params->phNativePlatform)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phPlatform = "; - ur_params::serializePtr(os, *(params->pphPlatform)); + ur_print::printPtr(os, *(params->pphPlatform)); return os; } @@ -14362,12 +14340,12 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_params::serializePtr(os, *(params->phPlatform)); + ur_print::printPtr(os, *(params->phPlatform)); os << ", "; os << ".pVersion = "; - ur_params::serializePtr(os, *(params->ppVersion)); + ur_print::printPtr(os, *(params->ppVersion)); return os; } @@ -14379,17 +14357,17 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_params::serializePtr(os, *(params->phPlatform)); + ur_print::printPtr(os, *(params->phPlatform)); os << ", "; os << ".pFrontendOption = "; - ur_params::serializePtr(os, *(params->ppFrontendOption)); + ur_print::printPtr(os, *(params->ppFrontendOption)); os << ", "; os << ".ppPlatformOption = "; - ur_params::serializePtr(os, *(params->pppPlatformOption)); + ur_print::printPtr(os, *(params->pppPlatformOption)); return os; } @@ -14400,12 +14378,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pIL = "; - ur_params::serializePtr(os, *(params->ppIL)); + ur_print::printPtr(os, *(params->ppIL)); os << ", "; os << ".length = "; @@ -14415,12 +14393,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phProgram = "; - ur_params::serializePtr(os, *(params->pphProgram)); + ur_print::printPtr(os, *(params->pphProgram)); return os; } @@ -14432,12 +14410,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -14447,17 +14425,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pBinary = "; - ur_params::serializePtr(os, *(params->ppBinary)); + ur_print::printPtr(os, *(params->ppBinary)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phProgram = "; - ur_params::serializePtr(os, *(params->pphProgram)); + ur_print::printPtr(os, *(params->pphProgram)); return os; } @@ -14468,17 +14446,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pOptions = "; - ur_params::serializePtr(os, *(params->ppOptions)); + ur_print::printPtr(os, *(params->ppOptions)); return os; } @@ -14489,17 +14467,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pOptions = "; - ur_params::serializePtr(os, *(params->ppOptions)); + ur_print::printPtr(os, *(params->ppOptions)); return os; } @@ -14510,7 +14488,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".count = "; @@ -14525,19 +14503,19 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphPrograms))[i]); + ur_print::printPtr(os, (*(params->pphPrograms))[i]); } os << "}"; os << ", "; os << ".pOptions = "; - ur_params::serializePtr(os, *(params->ppOptions)); + ur_print::printPtr(os, *(params->ppOptions)); os << ", "; os << ".phProgram = "; - ur_params::serializePtr(os, *(params->pphProgram)); + ur_print::printPtr(os, *(params->pphProgram)); return os; } @@ -14548,7 +14526,7 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); return os; } @@ -14559,7 +14537,7 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); return os; } @@ -14571,22 +14549,22 @@ inline std::ostream &operator<<( os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".pFunctionName = "; - ur_params::serializePtr(os, *(params->ppFunctionName)); + ur_print::printPtr(os, *(params->ppFunctionName)); os << ", "; os << ".ppFunctionPointer = "; - ur_params::serializePtr(os, *(params->pppFunctionPointer)); + ur_print::printPtr(os, *(params->pppFunctionPointer)); return os; } @@ -14597,7 +14575,7 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".propName = "; @@ -14611,13 +14589,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14628,12 +14606,12 @@ inline std::ostream &operator<<( os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -14647,13 +14625,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14664,7 +14642,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".count = "; @@ -14693,12 +14671,12 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_params::serializePtr(os, *(params->phProgram)); + ur_print::printPtr(os, *(params->phProgram)); os << ", "; os << ".phNativeProgram = "; - ur_params::serializePtr(os, *(params->pphNativeProgram)); + ur_print::printPtr(os, *(params->pphNativeProgram)); return os; } @@ -14710,22 +14688,22 @@ inline std::ostream &operator<<( os << ".hNativeProgram = "; - ur_params::serializePtr(os, *(params->phNativeProgram)); + ur_print::printPtr(os, *(params->phNativeProgram)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phProgram = "; - ur_params::serializePtr(os, *(params->pphProgram)); + ur_print::printPtr(os, *(params->pphProgram)); return os; } @@ -14736,7 +14714,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".propName = "; @@ -14750,13 +14728,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14767,22 +14745,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phQueue = "; - ur_params::serializePtr(os, *(params->pphQueue)); + ur_print::printPtr(os, *(params->pphQueue)); return os; } @@ -14793,7 +14771,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); return os; } @@ -14804,7 +14782,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); return os; } @@ -14815,17 +14793,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); os << ", "; os << ".pDesc = "; - ur_params::serializePtr(os, *(params->ppDesc)); + ur_print::printPtr(os, *(params->ppDesc)); os << ", "; os << ".phNativeQueue = "; - ur_params::serializePtr(os, *(params->pphNativeQueue)); + ur_print::printPtr(os, *(params->pphNativeQueue)); return os; } @@ -14837,27 +14815,27 @@ inline std::ostream &operator<<( os << ".hNativeQueue = "; - ur_params::serializePtr(os, *(params->phNativeQueue)); + ur_print::printPtr(os, *(params->phNativeQueue)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phQueue = "; - ur_params::serializePtr(os, *(params->pphQueue)); + ur_print::printPtr(os, *(params->pphQueue)); return os; } @@ -14868,7 +14846,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); return os; } @@ -14879,7 +14857,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_params::serializePtr(os, *(params->phQueue)); + ur_print::printPtr(os, *(params->phQueue)); return os; } @@ -14890,17 +14868,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pDesc = "; - ur_params::serializePtr(os, *(params->ppDesc)); + ur_print::printPtr(os, *(params->ppDesc)); os << ", "; os << ".phSampler = "; - ur_params::serializePtr(os, *(params->pphSampler)); + ur_print::printPtr(os, *(params->pphSampler)); return os; } @@ -14911,7 +14889,7 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_params::serializePtr(os, *(params->phSampler)); + ur_print::printPtr(os, *(params->phSampler)); return os; } @@ -14922,7 +14900,7 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_params::serializePtr(os, *(params->phSampler)); + ur_print::printPtr(os, *(params->phSampler)); return os; } @@ -14933,7 +14911,7 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_params::serializePtr(os, *(params->phSampler)); + ur_print::printPtr(os, *(params->phSampler)); os << ", "; os << ".propName = "; @@ -14947,13 +14925,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14965,12 +14943,12 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_params::serializePtr(os, *(params->phSampler)); + ur_print::printPtr(os, *(params->phSampler)); os << ", "; os << ".phNativeSampler = "; - ur_params::serializePtr(os, *(params->pphNativeSampler)); + ur_print::printPtr(os, *(params->pphNativeSampler)); return os; } @@ -14982,22 +14960,22 @@ inline std::ostream &operator<<( os << ".hNativeSampler = "; - ur_params::serializePtr(os, *(params->phNativeSampler)); + ur_print::printPtr(os, *(params->phNativeSampler)); os << ", "; os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phSampler = "; - ur_params::serializePtr(os, *(params->pphSampler)); + ur_print::printPtr(os, *(params->pphSampler)); return os; } @@ -15008,17 +14986,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pUSMDesc = "; - ur_params::serializePtr(os, *(params->ppUSMDesc)); + ur_print::printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_params::serializePtr(os, *(params->ppool)); + ur_print::printPtr(os, *(params->ppool)); os << ", "; os << ".size = "; @@ -15028,7 +15006,7 @@ operator<<(std::ostream &os, os << ", "; os << ".ppMem = "; - ur_params::serializePtr(os, *(params->pppMem)); + ur_print::printPtr(os, *(params->pppMem)); return os; } @@ -15039,22 +15017,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - ur_params::serializePtr(os, *(params->ppUSMDesc)); + ur_print::printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_params::serializePtr(os, *(params->ppool)); + ur_print::printPtr(os, *(params->ppool)); os << ", "; os << ".size = "; @@ -15064,7 +15042,7 @@ operator<<(std::ostream &os, os << ", "; os << ".ppMem = "; - ur_params::serializePtr(os, *(params->pppMem)); + ur_print::printPtr(os, *(params->pppMem)); return os; } @@ -15075,22 +15053,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - ur_params::serializePtr(os, *(params->ppUSMDesc)); + ur_print::printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_params::serializePtr(os, *(params->ppool)); + ur_print::printPtr(os, *(params->ppool)); os << ", "; os << ".size = "; @@ -15100,7 +15078,7 @@ operator<<(std::ostream &os, os << ", "; os << ".ppMem = "; - ur_params::serializePtr(os, *(params->pppMem)); + ur_print::printPtr(os, *(params->pppMem)); return os; } @@ -15111,12 +15089,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); return os; } @@ -15127,12 +15105,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); os << ", "; os << ".propName = "; @@ -15146,13 +15124,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15163,17 +15141,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pPoolDesc = "; - ur_params::serializePtr(os, *(params->ppPoolDesc)); + ur_print::printPtr(os, *(params->ppPoolDesc)); os << ", "; os << ".ppPool = "; - ur_params::serializePtr(os, *(params->pppPool)); + ur_print::printPtr(os, *(params->pppPool)); return os; } @@ -15184,7 +15162,7 @@ operator<<(std::ostream &os, os << ".pPool = "; - ur_params::serializePtr(os, *(params->ppPool)); + ur_print::printPtr(os, *(params->ppPool)); return os; } @@ -15195,7 +15173,7 @@ operator<<(std::ostream &os, os << ".pPool = "; - ur_params::serializePtr(os, *(params->ppPool)); + ur_print::printPtr(os, *(params->ppPool)); return os; } @@ -15206,7 +15184,7 @@ inline std::ostream &operator<<( os << ".hPool = "; - ur_params::serializePtr(os, *(params->phPool)); + ur_print::printPtr(os, *(params->phPool)); os << ", "; os << ".propName = "; @@ -15220,13 +15198,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15237,22 +15215,22 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - ur_params::serializePtr(os, *(params->ppUSMDesc)); + ur_print::printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_params::serializePtr(os, *(params->ppool)); + ur_print::printPtr(os, *(params->ppool)); os << ", "; os << ".widthInBytes = "; @@ -15272,12 +15250,12 @@ inline std::ostream &operator<<( os << ", "; os << ".ppMem = "; - ur_params::serializePtr(os, *(params->pppMem)); + ur_print::printPtr(os, *(params->pppMem)); os << ", "; os << ".pResultPitch = "; - ur_params::serializePtr(os, *(params->ppResultPitch)); + ur_print::printPtr(os, *(params->ppResultPitch)); return os; } @@ -15288,12 +15266,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; @@ -15309,12 +15287,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_params::serializePtr(os, *(params->ppMem)); + ur_print::printPtr(os, *(params->ppMem)); return os; } @@ -15326,12 +15304,12 @@ inline std::ostream &operator<<( os << ".commandDevice = "; - ur_params::serializePtr(os, *(params->pcommandDevice)); + ur_print::printPtr(os, *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - ur_params::serializePtr(os, *(params->ppeerDevice)); + ur_print::printPtr(os, *(params->ppeerDevice)); return os; } @@ -15343,12 +15321,12 @@ inline std::ostream &operator<<( os << ".commandDevice = "; - ur_params::serializePtr(os, *(params->pcommandDevice)); + ur_print::printPtr(os, *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - ur_params::serializePtr(os, *(params->ppeerDevice)); + ur_print::printPtr(os, *(params->ppeerDevice)); return os; } @@ -15360,12 +15338,12 @@ inline std::ostream &operator<<( os << ".commandDevice = "; - ur_params::serializePtr(os, *(params->pcommandDevice)); + ur_print::printPtr(os, *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - ur_params::serializePtr(os, *(params->ppeerDevice)); + ur_print::printPtr(os, *(params->ppeerDevice)); os << ", "; os << ".propName = "; @@ -15379,13 +15357,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15397,12 +15375,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15416,13 +15394,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15433,12 +15411,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_params::serializePtr(os, *(params->ppStart)); + ur_print::printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15448,7 +15426,7 @@ inline std::ostream &operator<<( os << ", "; os << ".ppStart = "; - ur_params::serializePtr(os, *(params->pppStart)); + ur_print::printPtr(os, *(params->pppStart)); return os; } @@ -15459,12 +15437,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_params::serializePtr(os, *(params->ppStart)); + ur_print::printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15480,12 +15458,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_params::serializePtr(os, *(params->ppStart)); + ur_print::printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15495,7 +15473,7 @@ operator<<(std::ostream &os, os << ", "; os << ".hPhysicalMem = "; - ur_params::serializePtr(os, *(params->phPhysicalMem)); + ur_print::printPtr(os, *(params->phPhysicalMem)); os << ", "; os << ".offset = "; @@ -15505,8 +15483,7 @@ operator<<(std::ostream &os, os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, - *(params->pflags)); + ur_print::printFlag(os, *(params->pflags)); return os; } @@ -15517,12 +15494,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_params::serializePtr(os, *(params->ppStart)); + ur_print::printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15538,12 +15515,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_params::serializePtr(os, *(params->ppStart)); + ur_print::printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15553,8 +15530,7 @@ inline std::ostream &operator<<( os << ", "; os << ".flags = "; - ur_params::serializeFlag(os, - *(params->pflags)); + ur_print::printFlag(os, *(params->pflags)); return os; } @@ -15565,12 +15541,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_params::serializePtr(os, *(params->phContext)); + ur_print::printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_params::serializePtr(os, *(params->ppStart)); + ur_print::printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15589,13 +15565,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15606,7 +15582,7 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_params::serializePtr(os, *(params->phPlatform)); + ur_print::printPtr(os, *(params->phPlatform)); os << ", "; os << ".DeviceType = "; @@ -15626,14 +15602,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphDevices))[i]); + ur_print::printPtr(os, (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevices = "; - ur_params::serializePtr(os, *(params->ppNumDevices)); + ur_print::printPtr(os, *(params->ppNumDevices)); return os; } @@ -15644,7 +15620,7 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15658,13 +15634,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_params::serializeTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_params::serializePtr(os, *(params->ppPropSizeRet)); + ur_print::printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15675,7 +15651,7 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); return os; } @@ -15686,7 +15662,7 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); return os; } @@ -15697,12 +15673,12 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".NumDevices = "; @@ -15717,14 +15693,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_params::serializePtr(os, (*(params->pphSubDevices))[i]); + ur_print::printPtr(os, (*(params->pphSubDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevicesRet = "; - ur_params::serializePtr(os, *(params->ppNumDevicesRet)); + ur_print::printPtr(os, *(params->ppNumDevicesRet)); return os; } @@ -15735,12 +15711,12 @@ inline std::ostream &operator<<( os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pBinaries = "; - ur_params::serializePtr(os, *(params->ppBinaries)); + ur_print::printPtr(os, *(params->ppBinaries)); os << ", "; os << ".NumBinaries = "; @@ -15750,7 +15726,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSelectedBinary = "; - ur_params::serializePtr(os, *(params->ppSelectedBinary)); + ur_print::printPtr(os, *(params->ppSelectedBinary)); return os; } @@ -15762,12 +15738,12 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".phNativeDevice = "; - ur_params::serializePtr(os, *(params->pphNativeDevice)); + ur_print::printPtr(os, *(params->pphNativeDevice)); return os; } @@ -15779,22 +15755,22 @@ inline std::ostream &operator<<( os << ".hNativeDevice = "; - ur_params::serializePtr(os, *(params->phNativeDevice)); + ur_print::printPtr(os, *(params->phNativeDevice)); os << ", "; os << ".hPlatform = "; - ur_params::serializePtr(os, *(params->phPlatform)); + ur_print::printPtr(os, *(params->phPlatform)); os << ", "; os << ".pProperties = "; - ur_params::serializePtr(os, *(params->ppProperties)); + ur_print::printPtr(os, *(params->ppProperties)); os << ", "; os << ".phDevice = "; - ur_params::serializePtr(os, *(params->pphDevice)); + ur_print::printPtr(os, *(params->pphDevice)); return os; } @@ -15806,29 +15782,29 @@ inline std::ostream &operator<<( os << ".hDevice = "; - ur_params::serializePtr(os, *(params->phDevice)); + ur_print::printPtr(os, *(params->phDevice)); os << ", "; os << ".pDeviceTimestamp = "; - ur_params::serializePtr(os, *(params->ppDeviceTimestamp)); + ur_print::printPtr(os, *(params->ppDeviceTimestamp)); os << ", "; os << ".pHostTimestamp = "; - ur_params::serializePtr(os, *(params->ppHostTimestamp)); + ur_print::printPtr(os, *(params->ppHostTimestamp)); return os; } -namespace ur_params { +namespace ur_print { -template inline void serializePtr(std::ostream &os, const T *ptr) { +template inline void printPtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; } else if constexpr (std::is_pointer_v) { os << (const void *)(ptr) << " ("; - serializePtr(os, *ptr); + printPtr(os, *ptr); os << ")"; } else if constexpr (std::is_void_v || is_handle_v) { os << (const void *)ptr; @@ -15843,8 +15819,8 @@ template inline void serializePtr(std::ostream &os, const T *ptr) { } } -inline int serializeFunctionParams(std::ostream &os, uint32_t function, - const void *params) { +inline int printFunctionParams(std::ostream &os, uint32_t function, + const void *params) { switch ((enum ur_function_t)function) { case UR_FUNCTION_ADAPTER_GET: { os << (const struct ur_adapter_get_params_t *)params; @@ -16451,6 +16427,6 @@ inline int serializeFunctionParams(std::ostream &os, uint32_t function, } return 0; } -} // namespace ur_params +} // namespace ur_print -#endif /* UR_PARAMS_HPP */ +#endif /* UR_PRINT_HPP */ diff --git a/test/conformance/testing/include/uur/checks.h b/test/conformance/testing/include/uur/checks.h index 649edfefe0..2ad3925842 100644 --- a/test/conformance/testing/include/uur/checks.h +++ b/test/conformance/testing/include/uur/checks.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include namespace uur { diff --git a/test/loader/loader_lifetime/urLoaderInit.cpp b/test/loader/loader_lifetime/urLoaderInit.cpp index 48060240b8..c2361faf6e 100644 --- a/test/loader/loader_lifetime/urLoaderInit.cpp +++ b/test/loader/loader_lifetime/urLoaderInit.cpp @@ -3,7 +3,7 @@ // See LICENSE.TXT // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include "fixtures.hpp" -#include +#include using urLoaderInitTestWithParam = ::testing::TestWithParam; @@ -17,7 +17,7 @@ INSTANTIATE_TEST_SUITE_P( UR_DEVICE_INIT_FLAG_FPGA | UR_DEVICE_INIT_FLAG_VPU), [](const ::testing::TestParamInfo &info) { std::stringstream ss; - ur_params::serializeFlag(ss, info.param); + ur_print::printFlag(ss, info.param); return GTestSanitizeString(ss.str()); }); diff --git a/test/loader/platforms/platforms.cpp b/test/loader/platforms/platforms.cpp index 8c8f5d7db5..0e3dd527e8 100644 --- a/test/loader/platforms/platforms.cpp +++ b/test/loader/platforms/platforms.cpp @@ -11,7 +11,7 @@ #include #include -#include +#include #include "ur_api.h" diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index d6310f8bbd..41e427ff0d 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -10,7 +10,7 @@ #include #include "ur_api.h" -#include "ur_params.hpp" +#include "ur_print.hpp" template class ParamsTest : public testing::Test { protected: @@ -405,22 +405,22 @@ typedef Typesparams.get_struct(); EXPECT_THAT(out.str(), MatchesRegex(this->params.get_expected())); } -TEST(SerializePtr, nested_void_ptrs) { +TEST(PrintPtr, nested_void_ptrs) { void *real = (void *)0xFEEDCAFEull; void **preal = ℜ void ***ppreal = &preal; void ****pppreal = &ppreal; std::ostringstream out; - serializePtr(out, pppreal); + printPtr(out, pppreal); EXPECT_THAT(out.str(), MatchesRegex(".+ \\(.+ \\(.+ \\(.+\\)\\)\\)")); } diff --git a/tools/urtrace/collector.cpp b/tools/urtrace/collector.cpp index 2d454afc37..7bf4cda012 100644 --- a/tools/urtrace/collector.cpp +++ b/tools/urtrace/collector.cpp @@ -28,7 +28,7 @@ #include "logger/ur_logger.hpp" #include "ur_api.h" -#include "ur_params.hpp" +#include "ur_print.hpp" #include "ur_util.hpp" #include "xpti/xpti_trace_framework.h" @@ -288,8 +288,6 @@ static std::unique_ptr &writer() { return writer; } -using namespace ur_params; - struct fn_context { uint64_t instance; std::optional start; @@ -333,8 +331,8 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, if (cli_args.no_args) { args_str << "..."; } else { - ur_params::serializeFunctionParams(args_str, args->function_id, - args->args_data); + ur_print::printFunctionParams(args_str, args->function_id, + args->args_data); } if (trace_type == TRACE_FN_BEGIN) { From eed98998d060b8b3f718d7a9c826efe6acc669a7 Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Wed, 6 Sep 2023 10:28:07 +0200 Subject: [PATCH 069/145] Move print operators into the ur_print namespace --- scripts/templates/print.hpp.mako | 30 +- source/common/logger/ur_sinks.hpp | 2 + source/common/ur_print.hpp | 1640 ++++++++++++++--------------- 3 files changed, 799 insertions(+), 873 deletions(-) diff --git a/scripts/templates/print.hpp.mako b/scripts/templates/print.hpp.mako index ddf17dff29..51d33bf684 100644 --- a/scripts/templates/print.hpp.mako +++ b/scripts/templates/print.hpp.mako @@ -27,15 +27,15 @@ from templates import helper as th <%def name="member(iname, itype, loop)"> %if iname == "pNext": - ${x}_print::printStruct(os, ${caller.body()}); + printStruct(os, ${caller.body()}); %elif th.type_traits.is_flags(itype): - ${x}_print::printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); + printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); %elif not loop and th.type_traits.is_pointer(itype): - ${x}_print::printPtr(os, ${caller.body()}); + printPtr(os, ${caller.body()}); %elif loop and th.type_traits.is_pointer_to_pointer(itype): - ${x}_print::printPtr(os, ${caller.body()}); + printPtr(os, ${caller.body()}); %elif th.type_traits.is_handle(itype): - ${x}_print::printPtr(os, ${caller.body()}); + printPtr(os, ${caller.body()}); %elif iname and iname.startswith("pfn"): os << reinterpret_cast(${caller.body()}); %else: @@ -83,7 +83,7 @@ def findMemberType(_item): os << "}"; %elif findMemberType(item) is not None and findMemberType(item)['type'] == "union": os << ".${iname} = "; - ${x}_print::printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); + printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); %elif th.type_traits.is_array(item['type']): os << ".${iname} = {"; for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){ @@ -97,7 +97,7 @@ def findMemberType(_item): os << "}"; %elif typename is not None: os << ".${iname} = "; - ${x}_print::printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); + printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); %else: os << ".${iname} = "; <%call expr="member(iname, itype, False)"> @@ -147,7 +147,6 @@ template inline void printTagged(std::ostream &os, const void *ptr, %endif %endfor # obj in spec['objects'] %endfor -} // namespace ${x}_print %for spec in specs: %for obj in spec['objects']: @@ -188,7 +187,6 @@ template inline void printTagged(std::ostream &os, const void *ptr, } %endif %if obj.get('typed_etors', False) is True: - namespace ${x}_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size) { if (ptr == NULL) { @@ -248,12 +246,11 @@ template inline void printTagged(std::ostream &os, const void *ptr, break; } } - } + %elif "structure_type" in obj['name']: - namespace ${x}_print { inline void printStruct(std::ostream &os, const void *ptr) { if (ptr == NULL) { - ${x}_print::printPtr(os, ptr); + printPtr(os, ptr); return; } @@ -266,7 +263,7 @@ template inline void printTagged(std::ostream &os, const void *ptr, %> case ${ename}: { const ${th.subt(n, tags, item['desc'])} *pstruct = (const ${th.subt(n, tags, item['desc'])} *)ptr; - ${x}_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; %endfor default: @@ -274,10 +271,8 @@ template inline void printTagged(std::ostream &os, const void *ptr, break; } } - } // namespace ${x}_print %endif %if th.type_traits.is_flags(obj['name']): -namespace ${x}_print { template<> inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag) { @@ -310,7 +305,6 @@ inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint os << "0"; } } -} // namespace ${x}_print %endif ## STRUCT/UNION ############################################################### %elif re.match(r"struct", obj['type']): @@ -332,7 +326,7 @@ inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make } %elif re.match(r"union", obj['type']) and obj['name']: <% tag = findUnionTag(obj) %> -inline void ${x}_print::printUnion( +inline void printUnion( std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params, const ${tag['type']} ${th.make_type_name(n, tags, tag)} tag @@ -381,8 +375,6 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct %endfor %endfor -namespace ${x}_print { - template inline void printPtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index 66322e98a6..4f3a0b9c80 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -13,8 +13,10 @@ #include "ur_filesystem_resolved.hpp" #include "ur_level.hpp" +#include "ur_print.hpp" namespace logger { +using namespace ur_print; class Sink { public: diff --git a/source/common/ur_print.hpp b/source/common/ur_print.hpp index 0f867dcfa3..a9f0bfb500 100644 --- a/source/common/ur_print.hpp +++ b/source/common/ur_print.hpp @@ -210,8 +210,6 @@ template <> inline void printTagged(std::ostream &os, const void *ptr, ur_exp_peer_info_t value, size_t size); -} // namespace ur_print - inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value); inline std::ostream &operator<<(std::ostream &os, enum ur_structure_type_t value); @@ -1384,10 +1382,9 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { inline void printStruct(std::ostream &os, const void *ptr) { if (ptr == NULL) { - ur_print::printPtr(os, ptr); + printPtr(os, ptr); return; } @@ -1398,252 +1395,251 @@ inline void printStruct(std::ostream &os, const void *ptr) { case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: { const ur_context_properties_t *pstruct = (const ur_context_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_IMAGE_DESC: { const ur_image_desc_t *pstruct = (const ur_image_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_PROPERTIES: { const ur_buffer_properties_t *pstruct = (const ur_buffer_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_REGION: { const ur_buffer_region_t *pstruct = (const ur_buffer_region_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES: { const ur_buffer_channel_properties_t *pstruct = (const ur_buffer_channel_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES: { const ur_buffer_alloc_location_properties_t *pstruct = (const ur_buffer_alloc_location_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES: { const ur_program_properties_t *pstruct = (const ur_program_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_DESC: { const ur_usm_desc_t *pstruct = (const ur_usm_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_HOST_DESC: { const ur_usm_host_desc_t *pstruct = (const ur_usm_host_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_DEVICE_DESC: { const ur_usm_device_desc_t *pstruct = (const ur_usm_device_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_POOL_DESC: { const ur_usm_pool_desc_t *pstruct = (const ur_usm_pool_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC: { const ur_usm_pool_limits_desc_t *pstruct = (const ur_usm_pool_limits_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_BINARY: { const ur_device_binary_t *pstruct = (const ur_device_binary_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_SAMPLER_DESC: { const ur_sampler_desc_t *pstruct = (const ur_sampler_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_PROPERTIES: { const ur_queue_properties_t *pstruct = (const ur_queue_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES: { const ur_queue_index_properties_t *pstruct = (const ur_queue_index_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES: { const ur_context_native_properties_t *pstruct = (const ur_context_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES: { const ur_kernel_native_properties_t *pstruct = (const ur_kernel_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES: { const ur_queue_native_properties_t *pstruct = (const ur_queue_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES: { const ur_mem_native_properties_t *pstruct = (const ur_mem_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES: { const ur_event_native_properties_t *pstruct = (const ur_event_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES: { const ur_platform_native_properties_t *pstruct = (const ur_platform_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES: { const ur_device_native_properties_t *pstruct = (const ur_device_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES: { const ur_program_native_properties_t *pstruct = (const ur_program_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES: { const ur_sampler_native_properties_t *pstruct = (const ur_sampler_native_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC: { const ur_queue_native_desc_t *pstruct = (const ur_queue_native_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES: { const ur_device_partition_properties_t *pstruct = (const ur_device_partition_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES: { const ur_kernel_arg_mem_obj_properties_t *pstruct = (const ur_kernel_arg_mem_obj_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES: { const ur_physical_mem_properties_t *pstruct = (const ur_physical_mem_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES: { const ur_kernel_arg_pointer_properties_t *pstruct = (const ur_kernel_arg_pointer_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES: { const ur_kernel_arg_sampler_properties_t *pstruct = (const ur_kernel_arg_sampler_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES: { const ur_kernel_exec_info_properties_t *pstruct = (const ur_kernel_exec_info_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES: { const ur_kernel_arg_value_properties_t *pstruct = (const ur_kernel_arg_value_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: { const ur_kernel_arg_local_properties_t *pstruct = (const ur_kernel_arg_local_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: { const ur_exp_command_buffer_desc_t *pstruct = (const ur_exp_command_buffer_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES: { const ur_exp_sampler_mip_properties_t *pstruct = (const ur_exp_sampler_mip_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC: { const ur_exp_interop_mem_desc_t *pstruct = (const ur_exp_interop_mem_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC: { const ur_exp_interop_semaphore_desc_t *pstruct = (const ur_exp_interop_semaphore_desc_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR: { const ur_exp_file_descriptor_t *pstruct = (const ur_exp_file_descriptor_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: { const ur_exp_win32_handle_t *pstruct = (const ur_exp_win32_handle_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: { const ur_exp_layered_image_properties_t *pstruct = (const ur_exp_layered_image_properties_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: { const ur_exp_sampler_addr_modes_t *pstruct = (const ur_exp_sampler_addr_modes_t *)ptr; - ur_print::printPtr(os, pstruct); + printPtr(os, pstruct); } break; default: os << "unknown enumerator"; break; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) { switch (value) { @@ -1955,7 +1951,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -1971,7 +1967,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -2047,7 +2043,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -2114,7 +2109,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_loader_config_info_t value) { switch (value) { @@ -2132,7 +2126,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_loader_config_info_t value, size_t size) { @@ -2167,7 +2160,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, const struct ur_code_location_t params) { os << "(struct ur_code_location_t){"; @@ -2211,7 +2204,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_adapter_info_t value, size_t size) { @@ -2254,7 +2246,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_backend_t value) { switch (value) { @@ -2321,7 +2313,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_platform_info_t value, size_t size) { @@ -2380,7 +2371,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value) { os << UR_MAJOR_VERSION(value) << "." << UR_MINOR_VERSION(value); return os; @@ -2397,7 +2388,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -2451,12 +2442,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".pDeviceTargetSpec = "; - ur_print::printPtr(os, (params.pDeviceTargetSpec)); + printPtr(os, (params.pDeviceTargetSpec)); os << "}"; return os; @@ -3033,7 +3024,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_device_info_t value, size_t size) { @@ -3154,7 +3144,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3170,7 +3160,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3186,7 +3176,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3200,7 +3190,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3890,7 +3880,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3904,7 +3894,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3918,7 +3908,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -3938,7 +3928,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -4042,7 +4032,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -4087,7 +4077,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4161,7 +4151,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4176,7 +4166,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4191,7 +4181,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4206,7 +4196,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4221,7 +4211,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4389,7 +4379,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4405,7 +4395,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4421,7 +4411,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4437,7 +4427,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -4839,7 +4829,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_device_affinity_domain_flag_t value) { switch (value) { @@ -4873,7 +4863,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -4956,7 +4945,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_device_partition_t value) { switch (value) { @@ -4983,9 +4971,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline void ur_print::printUnion(std::ostream &os, - const union ur_device_partition_value_t params, - const enum ur_device_partition_t tag) { +inline void printUnion(std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag) { os << "(union ur_device_partition_value_t){"; switch (tag) { @@ -5007,8 +4995,8 @@ inline void ur_print::printUnion(std::ostream &os, os << ".affinity_domain = "; - ur_print::printFlag( - os, (params.affinity_domain)); + printFlag(os, + (params.affinity_domain)); break; default: @@ -5028,7 +5016,7 @@ operator<<(std::ostream &os, os << ", "; os << ".value = "; - ur_print::printUnion(os, (params.value), params.type); + printUnion(os, (params.value), params.type); os << "}"; return os; @@ -5045,12 +5033,12 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, (params.pProperties)); + printPtr(os, (params.pProperties)); os << ", "; os << ".PropCount = "; @@ -5101,7 +5089,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -5207,7 +5194,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_device_mem_cache_type_t value) { switch (value) { @@ -5267,7 +5253,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -5306,7 +5291,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_device_native_properties_t params) { @@ -5319,7 +5303,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5358,7 +5342,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -5430,7 +5413,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_memory_scope_capability_flag_t value) { switch (value) { @@ -5460,7 +5442,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -5532,7 +5513,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, enum ur_device_usm_access_capability_flag_t value) { @@ -5559,7 +5539,6 @@ operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -5622,7 +5601,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_context_flag_t value) { switch (value) { @@ -5636,7 +5614,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -5662,7 +5639,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_context_properties_t params) { os << "(struct ur_context_properties_t){"; @@ -5674,12 +5650,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, (params.flags)); + printFlag(os, (params.flags)); os << "}"; return os; @@ -5729,7 +5705,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_context_info_t value, size_t size) { @@ -5764,7 +5739,7 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ", "; } - ur_print::printPtr(os, tptr[i]); + printPtr(os, tptr[i]); } os << "}"; } break; @@ -5822,7 +5797,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -5838,7 +5813,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -5854,7 +5829,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -5870,7 +5845,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -5879,7 +5854,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream & operator<<(std::ostream &os, const struct ur_context_native_properties_t params) { @@ -5892,7 +5867,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5934,7 +5909,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value) { } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -6013,7 +5987,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { switch (value) { @@ -6066,7 +6039,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, size_t size) { @@ -6100,7 +6072,7 @@ inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -6109,7 +6081,7 @@ inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_image_channel_order_t value) { switch (value) { @@ -6284,7 +6256,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value) { } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_image_info_t value, size_t size) { @@ -6397,7 +6368,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, const struct ur_image_format_t params) { os << "(struct ur_image_format_t){"; @@ -6425,7 +6396,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".type = "; @@ -6486,12 +6457,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".pHost = "; - ur_print::printPtr(os, (params.pHost)); + printPtr(os, (params.pHost)); os << "}"; return os; @@ -6508,7 +6479,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".channel = "; @@ -6530,7 +6501,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".location = "; @@ -6551,7 +6522,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".origin = "; @@ -6590,7 +6561,7 @@ operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -6675,7 +6646,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_sampler_info_t value, size_t size) { @@ -6709,7 +6679,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -6763,7 +6733,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, const struct ur_sampler_desc_t params) { os << "(struct ur_sampler_desc_t){"; @@ -6775,7 +6745,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".normalizedCoords = "; @@ -6807,7 +6777,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -6830,7 +6800,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -6857,7 +6826,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_device_mem_flag_t value) { switch (value) { @@ -6879,7 +6847,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -6929,7 +6896,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_pool_flag_t value) { switch (value) { @@ -6943,7 +6909,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -6970,7 +6935,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value) { switch (value) { @@ -7024,7 +6988,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_usm_alloc_info_t value, size_t size) { @@ -7086,7 +7049,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -7100,7 +7063,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -7109,7 +7072,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_usm_advice_flag_t value) { switch (value) { @@ -7179,7 +7142,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -7360,7 +7322,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_desc_t params) { os << "(struct ur_usm_desc_t){"; @@ -7372,12 +7333,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".hints = "; - ur_print::printFlag(os, (params.hints)); + printFlag(os, (params.hints)); os << ", "; os << ".align = "; @@ -7398,12 +7359,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, (params.flags)); + printFlag(os, (params.flags)); os << "}"; return os; @@ -7419,12 +7380,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, (params.flags)); + printFlag(os, (params.flags)); os << "}"; return os; @@ -7440,12 +7401,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, (params.flags)); + printFlag(os, (params.flags)); os << "}"; return os; @@ -7461,7 +7422,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".maxPoolableSize = "; @@ -7493,7 +7454,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_usm_pool_info_t value, size_t size) { @@ -7527,7 +7487,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -7536,7 +7496,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_granularity_info_t value) { switch (value) { @@ -7554,7 +7514,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_virtual_mem_granularity_info_t value, size_t size) { @@ -7597,7 +7556,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_access_flag_t value) { switch (value) { @@ -7619,7 +7578,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -7669,7 +7627,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_virtual_mem_info_t value) { switch (value) { @@ -7683,7 +7640,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_virtual_mem_info_t value, size_t size) { @@ -7705,7 +7661,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -7714,7 +7670,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_physical_mem_flag_t value) { switch (value) { @@ -7728,7 +7684,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -7755,7 +7710,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { os << "(struct ur_physical_mem_properties_t){"; @@ -7767,12 +7721,12 @@ operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, (params.flags)); + printFlag(os, (params.flags)); os << "}"; return os; @@ -7803,9 +7757,9 @@ inline std::ostream &operator<<(std::ostream &os, return os; } -inline void ur_print::printUnion(std::ostream &os, - const union ur_program_metadata_value_t params, - const enum ur_program_metadata_type_t tag) { +inline void printUnion(std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag) { os << "(union ur_program_metadata_value_t){"; switch (tag) { @@ -7827,14 +7781,14 @@ inline void ur_print::printUnion(std::ostream &os, os << ".pString = "; - ur_print::printPtr(os, (params.pString)); + printPtr(os, (params.pString)); break; case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: os << ".pData = "; - ur_print::printPtr(os, (params.pData)); + printPtr(os, (params.pData)); break; default: @@ -7849,7 +7803,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ".pName = "; - ur_print::printPtr(os, (params.pName)); + printPtr(os, (params.pName)); os << ", "; os << ".type = "; @@ -7863,7 +7817,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".value = "; - ur_print::printUnion(os, (params.value), params.type); + printUnion(os, (params.value), params.type); os << "}"; return os; @@ -7879,7 +7833,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".count = "; @@ -7945,7 +7899,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_program_info_t value, size_t size) { @@ -7979,7 +7932,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -8008,7 +7961,7 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ", "; } - ur_print::printPtr(os, tptr[i]); + printPtr(os, tptr[i]); } os << "}"; } break; @@ -8064,7 +8017,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_program_build_status_t value) { switch (value) { @@ -8140,7 +8093,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_program_build_info_t value, size_t size) { @@ -8197,7 +8149,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream & operator<<(std::ostream &os, const struct ur_specialization_constant_info_t params) { @@ -8215,7 +8167,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pValue = "; - ur_print::printPtr(os, (params.pValue)); + printPtr(os, (params.pValue)); os << "}"; return os; @@ -8232,7 +8184,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8254,7 +8206,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -8271,7 +8223,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -8312,7 +8264,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value) { } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_kernel_info_t value, size_t size) { @@ -8366,7 +8317,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -8380,7 +8331,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -8409,7 +8360,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_group_info_t value) { switch (value) { @@ -8443,7 +8394,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_kernel_group_info_t value, size_t size) { @@ -8544,7 +8494,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_sub_group_info_t value) { switch (value) { @@ -8570,7 +8520,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_kernel_sub_group_info_t value, size_t size) { @@ -8641,7 +8590,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_cache_config_t value) { switch (value) { @@ -8684,7 +8633,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_kernel_exec_info_t value, size_t size) { @@ -8743,7 +8691,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream & operator<<(std::ostream &os, const struct ur_kernel_arg_pointer_properties_t params) { @@ -8756,7 +8704,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -8773,7 +8721,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -8790,7 +8738,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -8807,12 +8755,12 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".memoryAccess = "; - ur_print::printFlag(os, (params.memoryAccess)); + printFlag(os, (params.memoryAccess)); os << "}"; return os; @@ -8829,7 +8777,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8875,7 +8823,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value) { } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_queue_info_t value, size_t size) { @@ -8895,7 +8842,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -8909,7 +8856,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -8923,7 +8870,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -8937,7 +8884,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printFlag(os, *tptr); + printFlag(os, *tptr); os << ")"; } break; @@ -8988,7 +8935,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { switch (value) { @@ -9041,7 +8988,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -9177,7 +9123,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_properties_t params) { os << "(struct ur_queue_properties_t){"; @@ -9189,12 +9134,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, (params.flags)); + printFlag(os, (params.flags)); os << "}"; return os; @@ -9210,7 +9155,7 @@ operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".computeIndex = "; @@ -9231,12 +9176,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".pNativeData = "; - ur_print::printPtr(os, (params.pNativeData)); + printPtr(os, (params.pNativeData)); os << "}"; return os; @@ -9252,7 +9197,7 @@ operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -9435,7 +9380,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value) { } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_event_info_t value, size_t size) { @@ -9455,7 +9399,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -9469,7 +9413,7 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << (const void *)(tptr) << " ("; - ur_print::printPtr(os, *tptr); + printPtr(os, *tptr); os << ")"; } break; @@ -9520,7 +9464,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream &operator<<(std::ostream &os, enum ur_profiling_info_t value) { switch (value) { @@ -9550,7 +9494,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_profiling_info_t value, size_t size) { @@ -9635,7 +9578,7 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print + inline std::ostream & operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << "(struct ur_event_native_properties_t){"; @@ -9647,7 +9590,7 @@ operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -9702,7 +9645,6 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value) { } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, uint32_t flag) { @@ -9749,7 +9691,6 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_usm_migration_flag_t value) { switch (value) { @@ -9763,7 +9704,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -9791,7 +9731,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, enum ur_exp_image_copy_flag_t value) { switch (value) { @@ -9813,7 +9752,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printFlag(std::ostream &os, @@ -9863,7 +9801,6 @@ inline void printFlag(std::ostream &os, os << "0"; } } -} // namespace ur_print inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_file_descriptor_t params) { os << "(struct ur_exp_file_descriptor_t){"; @@ -9875,7 +9812,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".fd = "; @@ -9896,12 +9833,12 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".handle = "; - ur_print::printPtr(os, (params.handle)); + printPtr(os, (params.handle)); os << "}"; return os; @@ -9918,7 +9855,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".minMipmapLevelClamp = "; @@ -9954,7 +9891,7 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".addrModes = {"; @@ -9981,7 +9918,7 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -9998,7 +9935,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -10015,7 +9952,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << ", "; os << ".numLayers = "; @@ -10036,7 +9973,7 @@ operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { os << ", "; os << ".pNext = "; - ur_print::printStruct(os, (params.pNext)); + printStruct(os, (params.pNext)); os << "}"; return os; @@ -10058,7 +9995,6 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -namespace ur_print { template <> inline void printTagged(std::ostream &os, const void *ptr, ur_exp_peer_info_t value, size_t size) { @@ -10101,7 +10037,6 @@ inline void printTagged(std::ostream &os, const void *ptr, break; } } -} // namespace ur_print inline std::ostream & operator<<(std::ostream &os, @@ -10119,14 +10054,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphAdapters))[i]); + printPtr(os, (*(params->pphAdapters))[i]); } os << "}"; os << ", "; os << ".pNumAdapters = "; - ur_print::printPtr(os, *(params->ppNumAdapters)); + printPtr(os, *(params->ppNumAdapters)); return os; } @@ -10137,7 +10072,7 @@ operator<<(std::ostream &os, os << ".hAdapter = "; - ur_print::printPtr(os, *(params->phAdapter)); + printPtr(os, *(params->phAdapter)); return os; } @@ -10148,7 +10083,7 @@ operator<<(std::ostream &os, os << ".hAdapter = "; - ur_print::printPtr(os, *(params->phAdapter)); + printPtr(os, *(params->phAdapter)); return os; } @@ -10159,17 +10094,17 @@ inline std::ostream &operator<<( os << ".hAdapter = "; - ur_print::printPtr(os, *(params->phAdapter)); + printPtr(os, *(params->phAdapter)); os << ", "; os << ".ppMessage = "; - ur_print::printPtr(os, *(params->pppMessage)); + printPtr(os, *(params->pppMessage)); os << ", "; os << ".pError = "; - ur_print::printPtr(os, *(params->ppError)); + printPtr(os, *(params->ppError)); return os; } @@ -10180,7 +10115,7 @@ operator<<(std::ostream &os, os << ".hAdapter = "; - ur_print::printPtr(os, *(params->phAdapter)); + printPtr(os, *(params->phAdapter)); os << ", "; os << ".propName = "; @@ -10194,13 +10129,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -10211,17 +10146,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hImage = "; - ur_print::printPtr(os, *(params->phImage)); + printPtr(os, *(params->phImage)); return os; } @@ -10232,17 +10167,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hImage = "; - ur_print::printPtr(os, *(params->phImage)); + printPtr(os, *(params->phImage)); return os; } @@ -10254,27 +10189,27 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".phImageMem = "; - ur_print::printPtr(os, *(params->pphImageMem)); + printPtr(os, *(params->pphImageMem)); return os; } @@ -10286,17 +10221,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_print::printPtr(os, *(params->phImageMem)); + printPtr(os, *(params->phImageMem)); return os; } @@ -10307,37 +10242,37 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_print::printPtr(os, *(params->phImageMem)); + printPtr(os, *(params->phImageMem)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".phMem = "; - ur_print::printPtr(os, *(params->pphMem)); + printPtr(os, *(params->pphMem)); os << ", "; os << ".phImage = "; - ur_print::printPtr(os, *(params->pphImage)); + printPtr(os, *(params->pphImage)); return os; } @@ -10348,42 +10283,42 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_print::printPtr(os, *(params->phImageMem)); + printPtr(os, *(params->phImageMem)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".hSampler = "; - ur_print::printPtr(os, *(params->phSampler)); + printPtr(os, *(params->phSampler)); os << ", "; os << ".phMem = "; - ur_print::printPtr(os, *(params->pphMem)); + printPtr(os, *(params->pphMem)); os << ", "; os << ".phImage = "; - ur_print::printPtr(os, *(params->pphImage)); + printPtr(os, *(params->pphImage)); return os; } @@ -10395,33 +10330,32 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".imageCopyFlags = "; - ur_print::printFlag(os, - *(params->pimageCopyFlags)); + printFlag(os, *(params->pimageCopyFlags)); os << ", "; os << ".srcOffset = "; @@ -10457,14 +10391,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -10476,7 +10410,7 @@ inline std::ostream &operator<<( os << ".hImageMem = "; - ur_print::printPtr(os, *(params->phImageMem)); + printPtr(os, *(params->phImageMem)); os << ", "; os << ".propName = "; @@ -10486,12 +10420,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printPtr(os, *(params->ppPropValue)); + printPtr(os, *(params->ppPropValue)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -10502,17 +10436,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hImageMem = "; - ur_print::printPtr(os, *(params->phImageMem)); + printPtr(os, *(params->phImageMem)); os << ", "; os << ".mipmapLevel = "; @@ -10522,7 +10456,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".phImageMem = "; - ur_print::printPtr(os, *(params->pphImageMem)); + printPtr(os, *(params->pphImageMem)); return os; } @@ -10534,17 +10468,17 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hMem = "; - ur_print::printPtr(os, *(params->phMem)); + printPtr(os, *(params->phMem)); return os; } @@ -10555,12 +10489,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -10570,12 +10504,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pInteropMemDesc = "; - ur_print::printPtr(os, *(params->ppInteropMemDesc)); + printPtr(os, *(params->ppInteropMemDesc)); os << ", "; os << ".phInteropMem = "; - ur_print::printPtr(os, *(params->pphInteropMem)); + printPtr(os, *(params->pphInteropMem)); return os; } @@ -10586,32 +10520,32 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".hInteropMem = "; - ur_print::printPtr(os, *(params->phInteropMem)); + printPtr(os, *(params->phInteropMem)); os << ", "; os << ".phImageMem = "; - ur_print::printPtr(os, *(params->pphImageMem)); + printPtr(os, *(params->pphImageMem)); return os; } @@ -10622,17 +10556,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hInteropMem = "; - ur_print::printPtr(os, *(params->phInteropMem)); + printPtr(os, *(params->phInteropMem)); return os; } @@ -10644,22 +10578,22 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pInteropSemaphoreDesc = "; - ur_print::printPtr(os, *(params->ppInteropSemaphoreDesc)); + printPtr(os, *(params->ppInteropSemaphoreDesc)); os << ", "; os << ".phInteropSemaphore = "; - ur_print::printPtr(os, *(params->pphInteropSemaphore)); + printPtr(os, *(params->pphInteropSemaphore)); return os; } @@ -10670,17 +10604,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hInteropSemaphore = "; - ur_print::printPtr(os, *(params->phInteropSemaphore)); + printPtr(os, *(params->phInteropSemaphore)); return os; } @@ -10691,12 +10625,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hSemaphore = "; - ur_print::printPtr(os, *(params->phSemaphore)); + printPtr(os, *(params->phSemaphore)); os << ", "; os << ".numEventsInWaitList = "; @@ -10712,14 +10646,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -10730,12 +10664,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hSemaphore = "; - ur_print::printPtr(os, *(params->phSemaphore)); + printPtr(os, *(params->phSemaphore)); os << ", "; os << ".numEventsInWaitList = "; @@ -10751,14 +10685,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -10770,22 +10704,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pCommandBufferDesc = "; - ur_print::printPtr(os, *(params->ppCommandBufferDesc)); + printPtr(os, *(params->ppCommandBufferDesc)); os << ", "; os << ".phCommandBuffer = "; - ur_print::printPtr(os, *(params->pphCommandBuffer)); + printPtr(os, *(params->pphCommandBuffer)); return os; } @@ -10797,7 +10731,7 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); return os; } @@ -10809,7 +10743,7 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); return os; } @@ -10821,7 +10755,7 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); return os; } @@ -10832,12 +10766,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -10847,17 +10781,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - ur_print::printPtr(os, *(params->ppGlobalWorkOffset)); + printPtr(os, *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - ur_print::printPtr(os, *(params->ppGlobalWorkSize)); + printPtr(os, *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - ur_print::printPtr(os, *(params->ppLocalWorkSize)); + printPtr(os, *(params->ppLocalWorkSize)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -10867,12 +10801,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -10883,17 +10817,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".size = "; @@ -10908,12 +10842,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -10925,17 +10859,17 @@ inline std::ostream &operator<<( os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".pMemory = "; - ur_print::printPtr(os, *(params->ppMemory)); + printPtr(os, *(params->ppMemory)); os << ", "; os << ".pPattern = "; - ur_print::printPtr(os, *(params->ppPattern)); + printPtr(os, *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -10955,12 +10889,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -10971,17 +10905,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hSrcMem = "; - ur_print::printPtr(os, *(params->phSrcMem)); + printPtr(os, *(params->phSrcMem)); os << ", "; os << ".hDstMem = "; - ur_print::printPtr(os, *(params->phDstMem)); + printPtr(os, *(params->phDstMem)); os << ", "; os << ".srcOffset = "; @@ -11006,12 +10940,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11022,12 +10956,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".offset = "; @@ -11042,7 +10976,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11052,12 +10986,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11068,12 +11002,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".offset = "; @@ -11088,7 +11022,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11098,12 +11032,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11114,17 +11048,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hSrcMem = "; - ur_print::printPtr(os, *(params->phSrcMem)); + printPtr(os, *(params->phSrcMem)); os << ", "; os << ".hDstMem = "; - ur_print::printPtr(os, *(params->phDstMem)); + printPtr(os, *(params->phDstMem)); os << ", "; os << ".srcOrigin = "; @@ -11169,12 +11103,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11185,12 +11119,12 @@ inline std::ostream &operator<<( os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".bufferOffset = "; @@ -11230,7 +11164,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11240,12 +11174,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11256,12 +11190,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".bufferOffset = "; @@ -11301,7 +11235,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -11311,12 +11245,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11327,17 +11261,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".pPattern = "; - ur_print::printPtr(os, *(params->ppPattern)); + printPtr(os, *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -11362,12 +11296,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - ur_print::printPtr(os, *(params->ppSyncPointWaitList)); + printPtr(os, *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - ur_print::printPtr(os, *(params->ppSyncPoint)); + printPtr(os, *(params->ppSyncPoint)); return os; } @@ -11461,12 +11395,12 @@ operator<<(std::ostream &os, os << ".hCommandBuffer = "; - ur_print::printPtr(os, *(params->phCommandBuffer)); + printPtr(os, *(params->phCommandBuffer)); os << ", "; os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11482,14 +11416,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11510,19 +11444,19 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphDevices))[i]); + printPtr(os, (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phContext = "; - ur_print::printPtr(os, *(params->pphContext)); + printPtr(os, *(params->pphContext)); return os; } @@ -11533,7 +11467,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); return os; } @@ -11544,7 +11478,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); return os; } @@ -11555,7 +11489,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".propName = "; @@ -11569,13 +11503,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -11587,12 +11521,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".phNativeContext = "; - ur_print::printPtr(os, *(params->pphNativeContext)); + printPtr(os, *(params->pphNativeContext)); return os; } @@ -11604,7 +11538,7 @@ inline std::ostream &operator<<( os << ".hNativeContext = "; - ur_print::printPtr(os, *(params->phNativeContext)); + printPtr(os, *(params->phNativeContext)); os << ", "; os << ".numDevices = "; @@ -11619,19 +11553,19 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphDevices))[i]); + printPtr(os, (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phContext = "; - ur_print::printPtr(os, *(params->pphContext)); + printPtr(os, *(params->pphContext)); return os; } @@ -11643,7 +11577,7 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pfnDeleter = "; @@ -11653,7 +11587,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pUserData = "; - ur_print::printPtr(os, *(params->ppUserData)); + printPtr(os, *(params->ppUserData)); return os; } @@ -11664,12 +11598,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -11679,17 +11613,17 @@ inline std::ostream &operator<<( os << ", "; os << ".pGlobalWorkOffset = "; - ur_print::printPtr(os, *(params->ppGlobalWorkOffset)); + printPtr(os, *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - ur_print::printPtr(os, *(params->ppGlobalWorkSize)); + printPtr(os, *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - ur_print::printPtr(os, *(params->ppLocalWorkSize)); + printPtr(os, *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -11705,14 +11639,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11723,7 +11657,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11739,14 +11673,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11758,7 +11692,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11774,14 +11708,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11792,12 +11726,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingRead = "; @@ -11817,7 +11751,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11833,14 +11767,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11852,12 +11786,12 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -11877,7 +11811,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -11893,14 +11827,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11912,12 +11846,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingRead = "; @@ -11962,7 +11896,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11978,14 +11912,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -11997,12 +11931,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -12047,7 +11981,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12063,14 +11997,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12081,17 +12015,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - ur_print::printPtr(os, *(params->phBufferSrc)); + printPtr(os, *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - ur_print::printPtr(os, *(params->phBufferDst)); + printPtr(os, *(params->phBufferDst)); os << ", "; os << ".srcOffset = "; @@ -12122,14 +12056,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12141,17 +12075,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - ur_print::printPtr(os, *(params->phBufferSrc)); + printPtr(os, *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - ur_print::printPtr(os, *(params->phBufferDst)); + printPtr(os, *(params->phBufferDst)); os << ", "; os << ".srcOrigin = "; @@ -12202,14 +12136,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12220,17 +12154,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".pPattern = "; - ur_print::printPtr(os, *(params->ppPattern)); + printPtr(os, *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -12261,14 +12195,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12279,12 +12213,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hImage = "; - ur_print::printPtr(os, *(params->phImage)); + printPtr(os, *(params->phImage)); os << ", "; os << ".blockingRead = "; @@ -12314,7 +12248,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -12330,14 +12264,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12348,12 +12282,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hImage = "; - ur_print::printPtr(os, *(params->phImage)); + printPtr(os, *(params->phImage)); os << ", "; os << ".blockingWrite = "; @@ -12383,7 +12317,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12399,14 +12333,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12417,17 +12351,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hImageSrc = "; - ur_print::printPtr(os, *(params->phImageSrc)); + printPtr(os, *(params->phImageSrc)); os << ", "; os << ".hImageDst = "; - ur_print::printPtr(os, *(params->phImageDst)); + printPtr(os, *(params->phImageDst)); os << ", "; os << ".srcOrigin = "; @@ -12458,14 +12392,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12476,12 +12410,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".blockingMap = "; @@ -12491,7 +12425,7 @@ inline std::ostream &operator<<( os << ", "; os << ".mapFlags = "; - ur_print::printFlag(os, *(params->pmapFlags)); + printFlag(os, *(params->pmapFlags)); os << ", "; os << ".offset = "; @@ -12517,19 +12451,19 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); os << ", "; os << ".ppRetMap = "; - ur_print::printPtr(os, *(params->pppRetMap)); + printPtr(os, *(params->pppRetMap)); return os; } @@ -12540,17 +12474,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hMem = "; - ur_print::printPtr(os, *(params->phMem)); + printPtr(os, *(params->phMem)); os << ", "; os << ".pMappedPtr = "; - ur_print::printPtr(os, *(params->ppMappedPtr)); + printPtr(os, *(params->ppMappedPtr)); os << ", "; os << ".numEventsInWaitList = "; @@ -12566,14 +12500,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12584,12 +12518,12 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".ptr = "; - ur_print::printPtr(os, *(params->pptr)); + printPtr(os, *(params->pptr)); os << ", "; os << ".patternSize = "; @@ -12599,7 +12533,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pPattern = "; - ur_print::printPtr(os, *(params->ppPattern)); + printPtr(os, *(params->ppPattern)); os << ", "; os << ".size = "; @@ -12620,14 +12554,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12638,7 +12572,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12648,12 +12582,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".size = "; @@ -12674,14 +12608,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12692,12 +12626,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; @@ -12707,7 +12641,7 @@ inline std::ostream &operator<<( os << ", "; os << ".flags = "; - ur_print::printFlag(os, *(params->pflags)); + printFlag(os, *(params->pflags)); os << ", "; os << ".numEventsInWaitList = "; @@ -12723,14 +12657,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12741,12 +12675,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; @@ -12756,12 +12690,12 @@ inline std::ostream &operator<<( os << ", "; os << ".advice = "; - ur_print::printFlag(os, *(params->padvice)); + printFlag(os, *(params->padvice)); os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12772,12 +12706,12 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); os << ", "; os << ".pitch = "; @@ -12792,7 +12726,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pPattern = "; - ur_print::printPtr(os, *(params->ppPattern)); + printPtr(os, *(params->ppPattern)); os << ", "; os << ".width = "; @@ -12818,14 +12752,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12836,7 +12770,7 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12846,7 +12780,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".dstPitch = "; @@ -12856,7 +12790,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".srcPitch = "; @@ -12887,14 +12821,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12905,17 +12839,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".name = "; - ur_print::printPtr(os, *(params->pname)); + printPtr(os, *(params->pname)); os << ", "; os << ".blockingWrite = "; @@ -12935,7 +12869,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12951,14 +12885,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -12969,17 +12903,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".name = "; - ur_print::printPtr(os, *(params->pname)); + printPtr(os, *(params->pname)); os << ", "; os << ".blockingRead = "; @@ -12999,7 +12933,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -13015,14 +12949,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -13033,17 +12967,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - ur_print::printPtr(os, *(params->ppipe_symbol)); + printPtr(os, *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13053,7 +12987,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - ur_print::printPtr(os, *(params->ppDst)); + printPtr(os, *(params->ppDst)); os << ", "; os << ".size = "; @@ -13074,14 +13008,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -13092,17 +13026,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - ur_print::printPtr(os, *(params->ppipe_symbol)); + printPtr(os, *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13112,7 +13046,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - ur_print::printPtr(os, *(params->ppSrc)); + printPtr(os, *(params->ppSrc)); os << ", "; os << ".size = "; @@ -13133,14 +13067,14 @@ inline std::ostream &operator<<( os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -13151,12 +13085,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -13166,17 +13100,17 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - ur_print::printPtr(os, *(params->ppGlobalWorkOffset)); + printPtr(os, *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - ur_print::printPtr(os, *(params->ppGlobalWorkSize)); + printPtr(os, *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - ur_print::printPtr(os, *(params->ppLocalWorkSize)); + printPtr(os, *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -13192,14 +13126,14 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -13210,7 +13144,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_print::printPtr(os, *(params->phEvent)); + printPtr(os, *(params->phEvent)); os << ", "; os << ".propName = "; @@ -13224,13 +13158,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13242,7 +13176,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_print::printPtr(os, *(params->phEvent)); + printPtr(os, *(params->phEvent)); os << ", "; os << ".propName = "; @@ -13256,13 +13190,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13283,7 +13217,7 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphEventWaitList))[i]); + printPtr(os, (*(params->pphEventWaitList))[i]); } os << "}"; @@ -13296,7 +13230,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_print::printPtr(os, *(params->phEvent)); + printPtr(os, *(params->phEvent)); return os; } @@ -13307,7 +13241,7 @@ operator<<(std::ostream &os, os << ".hEvent = "; - ur_print::printPtr(os, *(params->phEvent)); + printPtr(os, *(params->phEvent)); return os; } @@ -13318,12 +13252,12 @@ inline std::ostream &operator<<( os << ".hEvent = "; - ur_print::printPtr(os, *(params->phEvent)); + printPtr(os, *(params->phEvent)); os << ", "; os << ".phNativeEvent = "; - ur_print::printPtr(os, *(params->pphNativeEvent)); + printPtr(os, *(params->pphNativeEvent)); return os; } @@ -13335,22 +13269,22 @@ inline std::ostream &operator<<( os << ".hNativeEvent = "; - ur_print::printPtr(os, *(params->phNativeEvent)); + printPtr(os, *(params->phNativeEvent)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phEvent = "; - ur_print::printPtr(os, *(params->pphEvent)); + printPtr(os, *(params->pphEvent)); return os; } @@ -13361,7 +13295,7 @@ inline std::ostream &operator<<( os << ".hEvent = "; - ur_print::printPtr(os, *(params->phEvent)); + printPtr(os, *(params->phEvent)); os << ", "; os << ".execStatus = "; @@ -13376,7 +13310,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pUserData = "; - ur_print::printPtr(os, *(params->ppUserData)); + printPtr(os, *(params->ppUserData)); return os; } @@ -13387,17 +13321,17 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pKernelName = "; - ur_print::printPtr(os, *(params->ppKernelName)); + printPtr(os, *(params->ppKernelName)); os << ", "; os << ".phKernel = "; - ur_print::printPtr(os, *(params->pphKernel)); + printPtr(os, *(params->pphKernel)); return os; } @@ -13408,7 +13342,7 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".propName = "; @@ -13422,13 +13356,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13439,12 +13373,12 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -13458,13 +13392,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13476,12 +13410,12 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -13495,13 +13429,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13512,7 +13446,7 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); return os; } @@ -13523,7 +13457,7 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); return os; } @@ -13535,12 +13469,12 @@ operator<<(std::ostream &os, os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".phNativeKernel = "; - ur_print::printPtr(os, *(params->pphNativeKernel)); + printPtr(os, *(params->pphNativeKernel)); return os; } @@ -13552,27 +13486,27 @@ inline std::ostream &operator<<( os << ".hNativeKernel = "; - ur_print::printPtr(os, *(params->phNativeKernel)); + printPtr(os, *(params->phNativeKernel)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phKernel = "; - ur_print::printPtr(os, *(params->pphKernel)); + printPtr(os, *(params->pphKernel)); return os; } @@ -13583,7 +13517,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13598,12 +13532,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".pArgValue = "; - ur_print::printPtr(os, *(params->ppArgValue)); + printPtr(os, *(params->ppArgValue)); return os; } @@ -13614,7 +13548,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13629,7 +13563,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); return os; } @@ -13640,7 +13574,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13650,12 +13584,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".pArgValue = "; - ur_print::printPtr(os, *(params->ppArgValue)); + printPtr(os, *(params->ppArgValue)); return os; } @@ -13666,7 +13600,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".propName = "; @@ -13681,12 +13615,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); return os; } @@ -13697,7 +13631,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13707,12 +13641,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".hArgValue = "; - ur_print::printPtr(os, *(params->phArgValue)); + printPtr(os, *(params->phArgValue)); return os; } @@ -13723,7 +13657,7 @@ inline std::ostream &operator<<( os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -13733,12 +13667,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".hArgValue = "; - ur_print::printPtr(os, *(params->phArgValue)); + printPtr(os, *(params->phArgValue)); return os; } @@ -13749,7 +13683,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".count = "; @@ -13759,7 +13693,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSpecConstants = "; - ur_print::printPtr(os, *(params->ppSpecConstants)); + printPtr(os, *(params->ppSpecConstants)); return os; } @@ -13770,12 +13704,12 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - ur_print::printPtr(os, *(params->phKernel)); + printPtr(os, *(params->phKernel)); os << ", "; os << ".pGroupCountRet = "; - ur_print::printPtr(os, *(params->ppGroupCountRet)); + printPtr(os, *(params->ppGroupCountRet)); return os; } @@ -13786,12 +13720,12 @@ operator<<(std::ostream &os, os << ".device_flags = "; - ur_print::printFlag(os, *(params->pdevice_flags)); + printFlag(os, *(params->pdevice_flags)); os << ", "; os << ".hLoaderConfig = "; - ur_print::printPtr(os, *(params->phLoaderConfig)); + printPtr(os, *(params->phLoaderConfig)); return os; } @@ -13809,7 +13743,7 @@ inline std::ostream &operator<<( os << ".phLoaderConfig = "; - ur_print::printPtr(os, *(params->pphLoaderConfig)); + printPtr(os, *(params->pphLoaderConfig)); return os; } @@ -13820,7 +13754,7 @@ inline std::ostream &operator<<( os << ".hLoaderConfig = "; - ur_print::printPtr(os, *(params->phLoaderConfig)); + printPtr(os, *(params->phLoaderConfig)); return os; } @@ -13831,7 +13765,7 @@ inline std::ostream &operator<<( os << ".hLoaderConfig = "; - ur_print::printPtr(os, *(params->phLoaderConfig)); + printPtr(os, *(params->phLoaderConfig)); return os; } @@ -13842,7 +13776,7 @@ inline std::ostream &operator<<( os << ".hLoaderConfig = "; - ur_print::printPtr(os, *(params->phLoaderConfig)); + printPtr(os, *(params->phLoaderConfig)); os << ", "; os << ".propName = "; @@ -13856,13 +13790,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -13874,12 +13808,12 @@ operator<<(std::ostream &os, os << ".hLoaderConfig = "; - ur_print::printPtr(os, *(params->phLoaderConfig)); + printPtr(os, *(params->phLoaderConfig)); os << ", "; os << ".pLayerName = "; - ur_print::printPtr(os, *(params->ppLayerName)); + printPtr(os, *(params->ppLayerName)); return os; } @@ -13911,32 +13845,32 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, *(params->pflags)); + printFlag(os, *(params->pflags)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".pHost = "; - ur_print::printPtr(os, *(params->ppHost)); + printPtr(os, *(params->ppHost)); os << ", "; os << ".phMem = "; - ur_print::printPtr(os, *(params->pphMem)); + printPtr(os, *(params->pphMem)); return os; } @@ -13947,12 +13881,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, *(params->pflags)); + printFlag(os, *(params->pflags)); os << ", "; os << ".size = "; @@ -13962,12 +13896,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phBuffer = "; - ur_print::printPtr(os, *(params->pphBuffer)); + printPtr(os, *(params->pphBuffer)); return os; } @@ -13978,7 +13912,7 @@ operator<<(std::ostream &os, os << ".hMem = "; - ur_print::printPtr(os, *(params->phMem)); + printPtr(os, *(params->phMem)); return os; } @@ -13989,7 +13923,7 @@ operator<<(std::ostream &os, os << ".hMem = "; - ur_print::printPtr(os, *(params->phMem)); + printPtr(os, *(params->phMem)); return os; } @@ -14000,12 +13934,12 @@ inline std::ostream &operator<<( os << ".hBuffer = "; - ur_print::printPtr(os, *(params->phBuffer)); + printPtr(os, *(params->phBuffer)); os << ", "; os << ".flags = "; - ur_print::printFlag(os, *(params->pflags)); + printFlag(os, *(params->pflags)); os << ", "; os << ".bufferCreateType = "; @@ -14015,12 +13949,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pRegion = "; - ur_print::printPtr(os, *(params->ppRegion)); + printPtr(os, *(params->ppRegion)); os << ", "; os << ".phMem = "; - ur_print::printPtr(os, *(params->pphMem)); + printPtr(os, *(params->pphMem)); return os; } @@ -14031,12 +13965,12 @@ inline std::ostream &operator<<( os << ".hMem = "; - ur_print::printPtr(os, *(params->phMem)); + printPtr(os, *(params->phMem)); os << ", "; os << ".phNativeMem = "; - ur_print::printPtr(os, *(params->pphNativeMem)); + printPtr(os, *(params->pphNativeMem)); return os; } @@ -14047,22 +13981,22 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeMem = "; - ur_print::printPtr(os, *(params->phNativeMem)); + printPtr(os, *(params->phNativeMem)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phMem = "; - ur_print::printPtr(os, *(params->pphMem)); + printPtr(os, *(params->pphMem)); return os; } @@ -14073,32 +14007,32 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeMem = "; - ur_print::printPtr(os, *(params->phNativeMem)); + printPtr(os, *(params->phNativeMem)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pImageFormat = "; - ur_print::printPtr(os, *(params->ppImageFormat)); + printPtr(os, *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - ur_print::printPtr(os, *(params->ppImageDesc)); + printPtr(os, *(params->ppImageDesc)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phMem = "; - ur_print::printPtr(os, *(params->pphMem)); + printPtr(os, *(params->pphMem)); return os; } @@ -14109,7 +14043,7 @@ operator<<(std::ostream &os, os << ".hMemory = "; - ur_print::printPtr(os, *(params->phMemory)); + printPtr(os, *(params->phMemory)); os << ", "; os << ".propName = "; @@ -14123,13 +14057,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14140,7 +14074,7 @@ inline std::ostream &operator<<( os << ".hMemory = "; - ur_print::printPtr(os, *(params->phMemory)); + printPtr(os, *(params->phMemory)); os << ", "; os << ".propName = "; @@ -14154,13 +14088,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14171,12 +14105,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -14186,12 +14120,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phPhysicalMem = "; - ur_print::printPtr(os, *(params->pphPhysicalMem)); + printPtr(os, *(params->pphPhysicalMem)); return os; } @@ -14202,7 +14136,7 @@ inline std::ostream &operator<<( os << ".hPhysicalMem = "; - ur_print::printPtr(os, *(params->phPhysicalMem)); + printPtr(os, *(params->phPhysicalMem)); return os; } @@ -14213,7 +14147,7 @@ inline std::ostream &operator<<( os << ".hPhysicalMem = "; - ur_print::printPtr(os, *(params->phPhysicalMem)); + printPtr(os, *(params->phPhysicalMem)); return os; } @@ -14229,7 +14163,7 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphAdapters))[i]); + printPtr(os, (*(params->pphAdapters))[i]); } os << "}"; @@ -14251,14 +14185,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphPlatforms))[i]); + printPtr(os, (*(params->pphPlatforms))[i]); } os << "}"; os << ", "; os << ".pNumPlatforms = "; - ur_print::printPtr(os, *(params->ppNumPlatforms)); + printPtr(os, *(params->ppNumPlatforms)); return os; } @@ -14269,7 +14203,7 @@ inline std::ostream &operator<<( os << ".hPlatform = "; - ur_print::printPtr(os, *(params->phPlatform)); + printPtr(os, *(params->phPlatform)); os << ", "; os << ".propName = "; @@ -14283,13 +14217,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14301,12 +14235,12 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_print::printPtr(os, *(params->phPlatform)); + printPtr(os, *(params->phPlatform)); os << ", "; os << ".phNativePlatform = "; - ur_print::printPtr(os, *(params->pphNativePlatform)); + printPtr(os, *(params->pphNativePlatform)); return os; } @@ -14318,17 +14252,17 @@ inline std::ostream &operator<<( os << ".hNativePlatform = "; - ur_print::printPtr(os, *(params->phNativePlatform)); + printPtr(os, *(params->phNativePlatform)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phPlatform = "; - ur_print::printPtr(os, *(params->pphPlatform)); + printPtr(os, *(params->pphPlatform)); return os; } @@ -14340,12 +14274,12 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_print::printPtr(os, *(params->phPlatform)); + printPtr(os, *(params->phPlatform)); os << ", "; os << ".pVersion = "; - ur_print::printPtr(os, *(params->ppVersion)); + printPtr(os, *(params->ppVersion)); return os; } @@ -14357,17 +14291,17 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_print::printPtr(os, *(params->phPlatform)); + printPtr(os, *(params->phPlatform)); os << ", "; os << ".pFrontendOption = "; - ur_print::printPtr(os, *(params->ppFrontendOption)); + printPtr(os, *(params->ppFrontendOption)); os << ", "; os << ".ppPlatformOption = "; - ur_print::printPtr(os, *(params->pppPlatformOption)); + printPtr(os, *(params->pppPlatformOption)); return os; } @@ -14378,12 +14312,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pIL = "; - ur_print::printPtr(os, *(params->ppIL)); + printPtr(os, *(params->ppIL)); os << ", "; os << ".length = "; @@ -14393,12 +14327,12 @@ inline std::ostream &operator<<( os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phProgram = "; - ur_print::printPtr(os, *(params->pphProgram)); + printPtr(os, *(params->pphProgram)); return os; } @@ -14410,12 +14344,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".size = "; @@ -14425,17 +14359,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pBinary = "; - ur_print::printPtr(os, *(params->ppBinary)); + printPtr(os, *(params->ppBinary)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phProgram = "; - ur_print::printPtr(os, *(params->pphProgram)); + printPtr(os, *(params->pphProgram)); return os; } @@ -14446,17 +14380,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pOptions = "; - ur_print::printPtr(os, *(params->ppOptions)); + printPtr(os, *(params->ppOptions)); return os; } @@ -14467,17 +14401,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pOptions = "; - ur_print::printPtr(os, *(params->ppOptions)); + printPtr(os, *(params->ppOptions)); return os; } @@ -14488,7 +14422,7 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".count = "; @@ -14503,19 +14437,19 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphPrograms))[i]); + printPtr(os, (*(params->pphPrograms))[i]); } os << "}"; os << ", "; os << ".pOptions = "; - ur_print::printPtr(os, *(params->ppOptions)); + printPtr(os, *(params->ppOptions)); os << ", "; os << ".phProgram = "; - ur_print::printPtr(os, *(params->pphProgram)); + printPtr(os, *(params->pphProgram)); return os; } @@ -14526,7 +14460,7 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); return os; } @@ -14537,7 +14471,7 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); return os; } @@ -14549,22 +14483,22 @@ inline std::ostream &operator<<( os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".pFunctionName = "; - ur_print::printPtr(os, *(params->ppFunctionName)); + printPtr(os, *(params->ppFunctionName)); os << ", "; os << ".ppFunctionPointer = "; - ur_print::printPtr(os, *(params->pppFunctionPointer)); + printPtr(os, *(params->pppFunctionPointer)); return os; } @@ -14575,7 +14509,7 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".propName = "; @@ -14589,13 +14523,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14606,12 +14540,12 @@ inline std::ostream &operator<<( os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -14625,13 +14559,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14642,7 +14576,7 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".count = "; @@ -14671,12 +14605,12 @@ operator<<(std::ostream &os, os << ".hProgram = "; - ur_print::printPtr(os, *(params->phProgram)); + printPtr(os, *(params->phProgram)); os << ", "; os << ".phNativeProgram = "; - ur_print::printPtr(os, *(params->pphNativeProgram)); + printPtr(os, *(params->pphNativeProgram)); return os; } @@ -14688,22 +14622,22 @@ inline std::ostream &operator<<( os << ".hNativeProgram = "; - ur_print::printPtr(os, *(params->phNativeProgram)); + printPtr(os, *(params->phNativeProgram)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phProgram = "; - ur_print::printPtr(os, *(params->pphProgram)); + printPtr(os, *(params->pphProgram)); return os; } @@ -14714,7 +14648,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".propName = "; @@ -14728,13 +14662,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14745,22 +14679,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phQueue = "; - ur_print::printPtr(os, *(params->pphQueue)); + printPtr(os, *(params->pphQueue)); return os; } @@ -14771,7 +14705,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); return os; } @@ -14782,7 +14716,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); return os; } @@ -14793,17 +14727,17 @@ inline std::ostream &operator<<( os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); os << ", "; os << ".pDesc = "; - ur_print::printPtr(os, *(params->ppDesc)); + printPtr(os, *(params->ppDesc)); os << ", "; os << ".phNativeQueue = "; - ur_print::printPtr(os, *(params->pphNativeQueue)); + printPtr(os, *(params->pphNativeQueue)); return os; } @@ -14815,27 +14749,27 @@ inline std::ostream &operator<<( os << ".hNativeQueue = "; - ur_print::printPtr(os, *(params->phNativeQueue)); + printPtr(os, *(params->phNativeQueue)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phQueue = "; - ur_print::printPtr(os, *(params->pphQueue)); + printPtr(os, *(params->pphQueue)); return os; } @@ -14846,7 +14780,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); return os; } @@ -14857,7 +14791,7 @@ operator<<(std::ostream &os, os << ".hQueue = "; - ur_print::printPtr(os, *(params->phQueue)); + printPtr(os, *(params->phQueue)); return os; } @@ -14868,17 +14802,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pDesc = "; - ur_print::printPtr(os, *(params->ppDesc)); + printPtr(os, *(params->ppDesc)); os << ", "; os << ".phSampler = "; - ur_print::printPtr(os, *(params->pphSampler)); + printPtr(os, *(params->pphSampler)); return os; } @@ -14889,7 +14823,7 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_print::printPtr(os, *(params->phSampler)); + printPtr(os, *(params->phSampler)); return os; } @@ -14900,7 +14834,7 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_print::printPtr(os, *(params->phSampler)); + printPtr(os, *(params->phSampler)); return os; } @@ -14911,7 +14845,7 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_print::printPtr(os, *(params->phSampler)); + printPtr(os, *(params->phSampler)); os << ", "; os << ".propName = "; @@ -14925,13 +14859,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -14943,12 +14877,12 @@ operator<<(std::ostream &os, os << ".hSampler = "; - ur_print::printPtr(os, *(params->phSampler)); + printPtr(os, *(params->phSampler)); os << ", "; os << ".phNativeSampler = "; - ur_print::printPtr(os, *(params->pphNativeSampler)); + printPtr(os, *(params->pphNativeSampler)); return os; } @@ -14960,22 +14894,22 @@ inline std::ostream &operator<<( os << ".hNativeSampler = "; - ur_print::printPtr(os, *(params->phNativeSampler)); + printPtr(os, *(params->phNativeSampler)); os << ", "; os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phSampler = "; - ur_print::printPtr(os, *(params->pphSampler)); + printPtr(os, *(params->pphSampler)); return os; } @@ -14986,17 +14920,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pUSMDesc = "; - ur_print::printPtr(os, *(params->ppUSMDesc)); + printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_print::printPtr(os, *(params->ppool)); + printPtr(os, *(params->ppool)); os << ", "; os << ".size = "; @@ -15006,7 +14940,7 @@ operator<<(std::ostream &os, os << ", "; os << ".ppMem = "; - ur_print::printPtr(os, *(params->pppMem)); + printPtr(os, *(params->pppMem)); return os; } @@ -15017,22 +14951,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - ur_print::printPtr(os, *(params->ppUSMDesc)); + printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_print::printPtr(os, *(params->ppool)); + printPtr(os, *(params->ppool)); os << ", "; os << ".size = "; @@ -15042,7 +14976,7 @@ operator<<(std::ostream &os, os << ", "; os << ".ppMem = "; - ur_print::printPtr(os, *(params->pppMem)); + printPtr(os, *(params->pppMem)); return os; } @@ -15053,22 +14987,22 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - ur_print::printPtr(os, *(params->ppUSMDesc)); + printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_print::printPtr(os, *(params->ppool)); + printPtr(os, *(params->ppool)); os << ", "; os << ".size = "; @@ -15078,7 +15012,7 @@ operator<<(std::ostream &os, os << ", "; os << ".ppMem = "; - ur_print::printPtr(os, *(params->pppMem)); + printPtr(os, *(params->pppMem)); return os; } @@ -15089,12 +15023,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); return os; } @@ -15105,12 +15039,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); os << ", "; os << ".propName = "; @@ -15124,13 +15058,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15141,17 +15075,17 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pPoolDesc = "; - ur_print::printPtr(os, *(params->ppPoolDesc)); + printPtr(os, *(params->ppPoolDesc)); os << ", "; os << ".ppPool = "; - ur_print::printPtr(os, *(params->pppPool)); + printPtr(os, *(params->pppPool)); return os; } @@ -15162,7 +15096,7 @@ operator<<(std::ostream &os, os << ".pPool = "; - ur_print::printPtr(os, *(params->ppPool)); + printPtr(os, *(params->ppPool)); return os; } @@ -15173,7 +15107,7 @@ operator<<(std::ostream &os, os << ".pPool = "; - ur_print::printPtr(os, *(params->ppPool)); + printPtr(os, *(params->ppPool)); return os; } @@ -15184,7 +15118,7 @@ inline std::ostream &operator<<( os << ".hPool = "; - ur_print::printPtr(os, *(params->phPool)); + printPtr(os, *(params->phPool)); os << ", "; os << ".propName = "; @@ -15198,13 +15132,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15215,22 +15149,22 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - ur_print::printPtr(os, *(params->ppUSMDesc)); + printPtr(os, *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - ur_print::printPtr(os, *(params->ppool)); + printPtr(os, *(params->ppool)); os << ", "; os << ".widthInBytes = "; @@ -15250,12 +15184,12 @@ inline std::ostream &operator<<( os << ", "; os << ".ppMem = "; - ur_print::printPtr(os, *(params->pppMem)); + printPtr(os, *(params->pppMem)); os << ", "; os << ".pResultPitch = "; - ur_print::printPtr(os, *(params->ppResultPitch)); + printPtr(os, *(params->ppResultPitch)); return os; } @@ -15266,12 +15200,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); os << ", "; os << ".size = "; @@ -15287,12 +15221,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pMem = "; - ur_print::printPtr(os, *(params->ppMem)); + printPtr(os, *(params->ppMem)); return os; } @@ -15304,12 +15238,12 @@ inline std::ostream &operator<<( os << ".commandDevice = "; - ur_print::printPtr(os, *(params->pcommandDevice)); + printPtr(os, *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - ur_print::printPtr(os, *(params->ppeerDevice)); + printPtr(os, *(params->ppeerDevice)); return os; } @@ -15321,12 +15255,12 @@ inline std::ostream &operator<<( os << ".commandDevice = "; - ur_print::printPtr(os, *(params->pcommandDevice)); + printPtr(os, *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - ur_print::printPtr(os, *(params->ppeerDevice)); + printPtr(os, *(params->ppeerDevice)); return os; } @@ -15338,12 +15272,12 @@ inline std::ostream &operator<<( os << ".commandDevice = "; - ur_print::printPtr(os, *(params->pcommandDevice)); + printPtr(os, *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - ur_print::printPtr(os, *(params->ppeerDevice)); + printPtr(os, *(params->ppeerDevice)); os << ", "; os << ".propName = "; @@ -15357,13 +15291,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15375,12 +15309,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15394,13 +15328,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15411,12 +15345,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_print::printPtr(os, *(params->ppStart)); + printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15426,7 +15360,7 @@ inline std::ostream &operator<<( os << ", "; os << ".ppStart = "; - ur_print::printPtr(os, *(params->pppStart)); + printPtr(os, *(params->pppStart)); return os; } @@ -15437,12 +15371,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_print::printPtr(os, *(params->ppStart)); + printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15458,12 +15392,12 @@ operator<<(std::ostream &os, os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_print::printPtr(os, *(params->ppStart)); + printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15473,7 +15407,7 @@ operator<<(std::ostream &os, os << ", "; os << ".hPhysicalMem = "; - ur_print::printPtr(os, *(params->phPhysicalMem)); + printPtr(os, *(params->phPhysicalMem)); os << ", "; os << ".offset = "; @@ -15483,7 +15417,7 @@ operator<<(std::ostream &os, os << ", "; os << ".flags = "; - ur_print::printFlag(os, *(params->pflags)); + printFlag(os, *(params->pflags)); return os; } @@ -15494,12 +15428,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_print::printPtr(os, *(params->ppStart)); + printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15515,12 +15449,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_print::printPtr(os, *(params->ppStart)); + printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15530,7 +15464,7 @@ inline std::ostream &operator<<( os << ", "; os << ".flags = "; - ur_print::printFlag(os, *(params->pflags)); + printFlag(os, *(params->pflags)); return os; } @@ -15541,12 +15475,12 @@ inline std::ostream &operator<<( os << ".hContext = "; - ur_print::printPtr(os, *(params->phContext)); + printPtr(os, *(params->phContext)); os << ", "; os << ".pStart = "; - ur_print::printPtr(os, *(params->ppStart)); + printPtr(os, *(params->ppStart)); os << ", "; os << ".size = "; @@ -15565,13 +15499,13 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15582,7 +15516,7 @@ operator<<(std::ostream &os, os << ".hPlatform = "; - ur_print::printPtr(os, *(params->phPlatform)); + printPtr(os, *(params->phPlatform)); os << ", "; os << ".DeviceType = "; @@ -15602,14 +15536,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphDevices))[i]); + printPtr(os, (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevices = "; - ur_print::printPtr(os, *(params->ppNumDevices)); + printPtr(os, *(params->ppNumDevices)); return os; } @@ -15620,7 +15554,7 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15634,13 +15568,13 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - ur_print::printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + printTagged(os, *(params->ppPropValue), *(params->ppropName), + *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - ur_print::printPtr(os, *(params->ppPropSizeRet)); + printPtr(os, *(params->ppPropSizeRet)); return os; } @@ -15651,7 +15585,7 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); return os; } @@ -15662,7 +15596,7 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); return os; } @@ -15673,12 +15607,12 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".NumDevices = "; @@ -15693,14 +15627,14 @@ operator<<(std::ostream &os, os << ", "; } - ur_print::printPtr(os, (*(params->pphSubDevices))[i]); + printPtr(os, (*(params->pphSubDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevicesRet = "; - ur_print::printPtr(os, *(params->ppNumDevicesRet)); + printPtr(os, *(params->ppNumDevicesRet)); return os; } @@ -15711,12 +15645,12 @@ inline std::ostream &operator<<( os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pBinaries = "; - ur_print::printPtr(os, *(params->ppBinaries)); + printPtr(os, *(params->ppBinaries)); os << ", "; os << ".NumBinaries = "; @@ -15726,7 +15660,7 @@ inline std::ostream &operator<<( os << ", "; os << ".pSelectedBinary = "; - ur_print::printPtr(os, *(params->ppSelectedBinary)); + printPtr(os, *(params->ppSelectedBinary)); return os; } @@ -15738,12 +15672,12 @@ operator<<(std::ostream &os, os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".phNativeDevice = "; - ur_print::printPtr(os, *(params->pphNativeDevice)); + printPtr(os, *(params->pphNativeDevice)); return os; } @@ -15755,22 +15689,22 @@ inline std::ostream &operator<<( os << ".hNativeDevice = "; - ur_print::printPtr(os, *(params->phNativeDevice)); + printPtr(os, *(params->phNativeDevice)); os << ", "; os << ".hPlatform = "; - ur_print::printPtr(os, *(params->phPlatform)); + printPtr(os, *(params->phPlatform)); os << ", "; os << ".pProperties = "; - ur_print::printPtr(os, *(params->ppProperties)); + printPtr(os, *(params->ppProperties)); os << ", "; os << ".phDevice = "; - ur_print::printPtr(os, *(params->pphDevice)); + printPtr(os, *(params->pphDevice)); return os; } @@ -15782,23 +15716,21 @@ inline std::ostream &operator<<( os << ".hDevice = "; - ur_print::printPtr(os, *(params->phDevice)); + printPtr(os, *(params->phDevice)); os << ", "; os << ".pDeviceTimestamp = "; - ur_print::printPtr(os, *(params->ppDeviceTimestamp)); + printPtr(os, *(params->ppDeviceTimestamp)); os << ", "; os << ".pHostTimestamp = "; - ur_print::printPtr(os, *(params->ppHostTimestamp)); + printPtr(os, *(params->ppHostTimestamp)); return os; } -namespace ur_print { - template inline void printPtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; From 5f0e6d4eaff2a6afab13fe78dd7ced85811dab2f Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Mon, 18 Sep 2023 12:26:38 +0200 Subject: [PATCH 070/145] Move printing C++ API to include --- {source/common => include}/ur_print.hpp | 10840 ++++++++--------- scripts/Doxyfile | 3 +- scripts/core/INTRO.rst | 8 + scripts/generate_code.py | 5 +- scripts/templates/print.hpp.mako | 200 +- source/common/logger/ur_sinks.hpp | 2 +- test/loader/loader_lifetime/urLoaderInit.cpp | 2 +- test/unit/utils/params.cpp | 4 +- tools/urtrace/collector.cpp | 4 +- 9 files changed, 5533 insertions(+), 5535 deletions(-) rename {source/common => include}/ur_print.hpp (54%) diff --git a/source/common/ur_print.hpp b/include/ur_print.hpp similarity index 54% rename from source/common/ur_print.hpp rename to include/ur_print.hpp index a9f0bfb500..6a47b955bc 100644 --- a/source/common/ur_print.hpp +++ b/include/ur_print.hpp @@ -7,6 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_print.hpp + * @version v0.8-r0 * */ #ifndef UR_PRINT_HPP @@ -16,1186 +17,858 @@ #include #include -namespace ur_print { -template struct is_handle : std::false_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; -template <> struct is_handle : std::true_type {}; +namespace ur { +namespace print { +namespace details { +template +struct is_handle : std::false_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; +template <> +struct is_handle : std::true_type {}; template <> struct is_handle : std::true_type {}; template <> struct is_handle : std::true_type {}; -template inline constexpr bool is_handle_v = is_handle::value; -template inline void printPtr(std::ostream &os, const T *ptr); -template inline void printFlag(std::ostream &os, uint32_t flag); template -inline void printTagged(std::ostream &os, const void *ptr, T value, - size_t size); +inline constexpr bool is_handle_v = is_handle::value; +template +inline ur_result_t printPtr(std::ostream &os, const T *ptr); +template +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); +template +inline ur_result_t printTagged(std::ostream &os, const void *ptr, T value, size_t size); -inline void printStruct(std::ostream &os, const void *ptr); +inline ur_result_t printStruct(std::ostream &os, const void *ptr); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_loader_config_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_loader_config_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_adapter_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_adapter_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_platform_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_platform_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_device_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); -inline void printUnion(std::ostream &os, - const union ur_device_partition_value_t params, - const enum ur_device_partition_t tag); +inline ur_result_t printUnion( + std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_context_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, - size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_image_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_image_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_sampler_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_sampler_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_usm_alloc_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_alloc_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_usm_pool_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_pool_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_granularity_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem_granularity_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); -inline void printUnion(std::ostream &os, - const union ur_program_metadata_value_t params, - const enum ur_program_metadata_type_t tag); +inline ur_result_t printUnion( + std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_program_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_program_build_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_build_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_group_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_group_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_sub_group_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_sub_group_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_exec_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_exec_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_queue_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_event_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_event_info_t value, size_t size); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_profiling_info_t value, size_t size); +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_profiling_info_t value, size_t size); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printFlag(std::ostream &os, - uint32_t flag); +inline ur_result_t printFlag(std::ostream &os, uint32_t flag); template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_exp_peer_info_t value, size_t size); - -inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_structure_type_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_base_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_base_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_rect_offset_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_rect_region_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_init_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_loader_config_info_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_code_location_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_adapter_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_adapter_backend_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_platform_info_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_platform_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_platform_backend_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_binary_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_affinity_domain_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_partition_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_partition_property_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_device_partition_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_fp_capability_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_mem_cache_type_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_local_mem_type_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_exec_capability_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_memory_order_capability_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_memory_scope_capability_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, enum ur_device_usm_access_capability_flag_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_context_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_context_info_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_image_channel_order_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_image_channel_type_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_image_format_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_image_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_buffer_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_buffer_channel_properties_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_buffer_alloc_location_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_buffer_region_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_buffer_create_type_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_mem_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_sampler_filter_mode_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_sampler_addressing_mode_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_sampler_info_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_host_mem_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_device_mem_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_pool_flag_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_alloc_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_advice_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_host_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_device_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_pool_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_virtual_mem_granularity_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_virtual_mem_access_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_virtual_mem_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_physical_mem_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_physical_mem_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_metadata_type_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_metadata_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_program_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_build_status_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_binary_type_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_build_info_t value); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_specialization_constant_info_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_native_properties_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_arg_value_properties_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_arg_local_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_group_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_sub_group_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_cache_config_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_exec_info_t value); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_arg_pointer_properties_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_exec_info_properties_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_arg_sampler_properties_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_arg_mem_obj_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_index_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_native_desc_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_event_status_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_profiling_info_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_event_native_properties_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_execution_info_t value); -inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_migration_flag_t value); -inline std::ostream &operator<<(std::ostream &os, - enum ur_exp_image_copy_flag_t value); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_exp_file_descriptor_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_exp_win32_handle_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params); -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_exp_layered_image_properties_t params); -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); -inline std::ostream &operator<<(std::ostream &os, - enum ur_exp_peer_info_t value); - -inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_exp_peer_info_t value, size_t size); + +} // namespace details + +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_function_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_result_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_base_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_base_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_offset_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_region_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_init_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_loader_config_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_code_location_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_adapter_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_adapter_backend_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_platform_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_api_version_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_platform_backend_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_binary_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_affinity_domain_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_partition_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_property_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_fp_capability_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_mem_cache_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_local_mem_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_exec_capability_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_memory_order_capability_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_memory_scope_capability_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_usm_access_capability_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_context_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_context_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_mem_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_mem_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_mem_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_image_channel_order_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_image_channel_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_image_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_image_format_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_image_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_channel_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_alloc_location_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_region_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_buffer_create_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_sampler_filter_mode_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_sampler_addressing_mode_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_sampler_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_host_mem_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_device_mem_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_alloc_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_host_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_device_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_granularity_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_access_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_physical_mem_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_metadata_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_metadata_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_build_status_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_binary_type_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_build_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_specialization_constant_info_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_value_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_local_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_group_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_sub_group_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_cache_config_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_exec_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_pointer_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_exec_info_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_sampler_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_mem_obj_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_queue_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_queue_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_index_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_native_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_command_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_event_status_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_event_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_profiling_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_native_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_execution_info_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_map_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_migration_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_exp_image_copy_flag_t value); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_file_descriptor_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_win32_handle_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_layered_image_properties_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); +UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_function_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_function_t value) { switch (value) { - case UR_FUNCTION_CONTEXT_CREATE: os << "UR_FUNCTION_CONTEXT_CREATE"; break; - case UR_FUNCTION_CONTEXT_RETAIN: os << "UR_FUNCTION_CONTEXT_RETAIN"; break; - case UR_FUNCTION_CONTEXT_RELEASE: os << "UR_FUNCTION_CONTEXT_RELEASE"; break; - case UR_FUNCTION_CONTEXT_GET_INFO: os << "UR_FUNCTION_CONTEXT_GET_INFO"; break; - case UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE: os << "UR_FUNCTION_CONTEXT_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER: os << "UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER"; break; - case UR_FUNCTION_DEVICE_GET: os << "UR_FUNCTION_DEVICE_GET"; break; - case UR_FUNCTION_DEVICE_GET_INFO: os << "UR_FUNCTION_DEVICE_GET_INFO"; break; - case UR_FUNCTION_DEVICE_RETAIN: os << "UR_FUNCTION_DEVICE_RETAIN"; break; - case UR_FUNCTION_DEVICE_RELEASE: os << "UR_FUNCTION_DEVICE_RELEASE"; break; - case UR_FUNCTION_DEVICE_PARTITION: os << "UR_FUNCTION_DEVICE_PARTITION"; break; - case UR_FUNCTION_DEVICE_SELECT_BINARY: os << "UR_FUNCTION_DEVICE_SELECT_BINARY"; break; - case UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE: os << "UR_FUNCTION_DEVICE_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS: os << "UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS"; break; - case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH: os << "UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH"; break; - case UR_FUNCTION_ENQUEUE_EVENTS_WAIT: os << "UR_FUNCTION_ENQUEUE_EVENTS_WAIT"; break; - case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER: os << "UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL"; break; - case UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ: os << "UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ"; break; - case UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE: os << "UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE"; break; - case UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY: os << "UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY"; break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP: os << "UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP"; break; - case UR_FUNCTION_ENQUEUE_MEM_UNMAP: os << "UR_FUNCTION_ENQUEUE_MEM_UNMAP"; break; - case UR_FUNCTION_ENQUEUE_USM_FILL: os << "UR_FUNCTION_ENQUEUE_USM_FILL"; break; - case UR_FUNCTION_ENQUEUE_USM_MEMCPY: os << "UR_FUNCTION_ENQUEUE_USM_MEMCPY"; break; - case UR_FUNCTION_ENQUEUE_USM_PREFETCH: os << "UR_FUNCTION_ENQUEUE_USM_PREFETCH"; break; - case UR_FUNCTION_ENQUEUE_USM_ADVISE: os << "UR_FUNCTION_ENQUEUE_USM_ADVISE"; break; - case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE: os << "UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE"; break; - case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ: os << "UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ"; break; - case UR_FUNCTION_EVENT_GET_INFO: os << "UR_FUNCTION_EVENT_GET_INFO"; break; - case UR_FUNCTION_EVENT_GET_PROFILING_INFO: os << "UR_FUNCTION_EVENT_GET_PROFILING_INFO"; break; - case UR_FUNCTION_EVENT_WAIT: os << "UR_FUNCTION_EVENT_WAIT"; break; - case UR_FUNCTION_EVENT_RETAIN: os << "UR_FUNCTION_EVENT_RETAIN"; break; - case UR_FUNCTION_EVENT_RELEASE: os << "UR_FUNCTION_EVENT_RELEASE"; break; - case UR_FUNCTION_EVENT_GET_NATIVE_HANDLE: os << "UR_FUNCTION_EVENT_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_EVENT_SET_CALLBACK: os << "UR_FUNCTION_EVENT_SET_CALLBACK"; break; - case UR_FUNCTION_KERNEL_CREATE: os << "UR_FUNCTION_KERNEL_CREATE"; break; - case UR_FUNCTION_KERNEL_SET_ARG_VALUE: os << "UR_FUNCTION_KERNEL_SET_ARG_VALUE"; break; - case UR_FUNCTION_KERNEL_SET_ARG_LOCAL: os << "UR_FUNCTION_KERNEL_SET_ARG_LOCAL"; break; - case UR_FUNCTION_KERNEL_GET_INFO: os << "UR_FUNCTION_KERNEL_GET_INFO"; break; - case UR_FUNCTION_KERNEL_GET_GROUP_INFO: os << "UR_FUNCTION_KERNEL_GET_GROUP_INFO"; break; - case UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO: os << "UR_FUNCTION_KERNEL_GET_SUB_GROUP_INFO"; break; - case UR_FUNCTION_KERNEL_RETAIN: os << "UR_FUNCTION_KERNEL_RETAIN"; break; - case UR_FUNCTION_KERNEL_RELEASE: os << "UR_FUNCTION_KERNEL_RELEASE"; break; - case UR_FUNCTION_KERNEL_SET_ARG_POINTER: os << "UR_FUNCTION_KERNEL_SET_ARG_POINTER"; break; - case UR_FUNCTION_KERNEL_SET_EXEC_INFO: os << "UR_FUNCTION_KERNEL_SET_EXEC_INFO"; break; - case UR_FUNCTION_KERNEL_SET_ARG_SAMPLER: os << "UR_FUNCTION_KERNEL_SET_ARG_SAMPLER"; break; - case UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ: os << "UR_FUNCTION_KERNEL_SET_ARG_MEM_OBJ"; break; - case UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS: os << "UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS"; break; - case UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE: os << "UR_FUNCTION_KERNEL_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_MEM_IMAGE_CREATE: os << "UR_FUNCTION_MEM_IMAGE_CREATE"; break; - case UR_FUNCTION_MEM_BUFFER_CREATE: os << "UR_FUNCTION_MEM_BUFFER_CREATE"; break; - case UR_FUNCTION_MEM_RETAIN: os << "UR_FUNCTION_MEM_RETAIN"; break; - case UR_FUNCTION_MEM_RELEASE: os << "UR_FUNCTION_MEM_RELEASE"; break; - case UR_FUNCTION_MEM_BUFFER_PARTITION: os << "UR_FUNCTION_MEM_BUFFER_PARTITION"; break; - case UR_FUNCTION_MEM_GET_NATIVE_HANDLE: os << "UR_FUNCTION_MEM_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_ENQUEUE_READ_HOST_PIPE: os << "UR_FUNCTION_ENQUEUE_READ_HOST_PIPE"; break; - case UR_FUNCTION_MEM_GET_INFO: os << "UR_FUNCTION_MEM_GET_INFO"; break; - case UR_FUNCTION_MEM_IMAGE_GET_INFO: os << "UR_FUNCTION_MEM_IMAGE_GET_INFO"; break; - case UR_FUNCTION_PLATFORM_GET: os << "UR_FUNCTION_PLATFORM_GET"; break; - case UR_FUNCTION_PLATFORM_GET_INFO: os << "UR_FUNCTION_PLATFORM_GET_INFO"; break; - case UR_FUNCTION_PLATFORM_GET_API_VERSION: os << "UR_FUNCTION_PLATFORM_GET_API_VERSION"; break; - case UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE: os << "UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_PROGRAM_CREATE_WITH_IL: os << "UR_FUNCTION_PROGRAM_CREATE_WITH_IL"; break; - case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY: os << "UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY"; break; - case UR_FUNCTION_PROGRAM_BUILD: os << "UR_FUNCTION_PROGRAM_BUILD"; break; - case UR_FUNCTION_PROGRAM_COMPILE: os << "UR_FUNCTION_PROGRAM_COMPILE"; break; - case UR_FUNCTION_PROGRAM_LINK: os << "UR_FUNCTION_PROGRAM_LINK"; break; - case UR_FUNCTION_PROGRAM_RETAIN: os << "UR_FUNCTION_PROGRAM_RETAIN"; break; - case UR_FUNCTION_PROGRAM_RELEASE: os << "UR_FUNCTION_PROGRAM_RELEASE"; break; - case UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER: os << "UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER"; break; - case UR_FUNCTION_PROGRAM_GET_INFO: os << "UR_FUNCTION_PROGRAM_GET_INFO"; break; - case UR_FUNCTION_PROGRAM_GET_BUILD_INFO: os << "UR_FUNCTION_PROGRAM_GET_BUILD_INFO"; break; - case UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS: os << "UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS"; break; - case UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE: os << "UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_QUEUE_GET_INFO: os << "UR_FUNCTION_QUEUE_GET_INFO"; break; - case UR_FUNCTION_QUEUE_CREATE: os << "UR_FUNCTION_QUEUE_CREATE"; break; - case UR_FUNCTION_QUEUE_RETAIN: os << "UR_FUNCTION_QUEUE_RETAIN"; break; - case UR_FUNCTION_QUEUE_RELEASE: os << "UR_FUNCTION_QUEUE_RELEASE"; break; - case UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE: os << "UR_FUNCTION_QUEUE_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_QUEUE_FINISH: os << "UR_FUNCTION_QUEUE_FINISH"; break; - case UR_FUNCTION_QUEUE_FLUSH: os << "UR_FUNCTION_QUEUE_FLUSH"; break; - case UR_FUNCTION_SAMPLER_CREATE: os << "UR_FUNCTION_SAMPLER_CREATE"; break; - case UR_FUNCTION_SAMPLER_RETAIN: os << "UR_FUNCTION_SAMPLER_RETAIN"; break; - case UR_FUNCTION_SAMPLER_RELEASE: os << "UR_FUNCTION_SAMPLER_RELEASE"; break; - case UR_FUNCTION_SAMPLER_GET_INFO: os << "UR_FUNCTION_SAMPLER_GET_INFO"; break; - case UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE: os << "UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE"; break; - case UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_USM_HOST_ALLOC: os << "UR_FUNCTION_USM_HOST_ALLOC"; break; - case UR_FUNCTION_USM_DEVICE_ALLOC: os << "UR_FUNCTION_USM_DEVICE_ALLOC"; break; - case UR_FUNCTION_USM_SHARED_ALLOC: os << "UR_FUNCTION_USM_SHARED_ALLOC"; break; - case UR_FUNCTION_USM_FREE: os << "UR_FUNCTION_USM_FREE"; break; - case UR_FUNCTION_USM_GET_MEM_ALLOC_INFO: os << "UR_FUNCTION_USM_GET_MEM_ALLOC_INFO"; break; - case UR_FUNCTION_USM_POOL_CREATE: os << "UR_FUNCTION_USM_POOL_CREATE"; break; - case UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP"; break; - case UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION: os << "UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION"; break; - case UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE: os << "UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE"; break; - case UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE: os << "UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE"; break; - case UR_FUNCTION_USM_POOL_RETAIN: os << "UR_FUNCTION_USM_POOL_RETAIN"; break; - case UR_FUNCTION_USM_POOL_RELEASE: os << "UR_FUNCTION_USM_POOL_RELEASE"; break; - case UR_FUNCTION_USM_POOL_GET_INFO: os << "UR_FUNCTION_USM_POOL_GET_INFO"; break; - case UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP"; break; - case UR_FUNCTION_USM_PITCHED_ALLOC_EXP: os << "UR_FUNCTION_USM_PITCHED_ALLOC_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXP: - os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_OPAQUE_FD_" - "EXP"; + os << "UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP"; break; - case UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP: os << "UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP"; break; - case UR_FUNCTION_ENQUEUE_USM_FILL_2D: os << "UR_FUNCTION_ENQUEUE_USM_FILL_2D"; break; - case UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D: os << "UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D"; break; - case UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO: os << "UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO"; break; - case UR_FUNCTION_VIRTUAL_MEM_RESERVE: os << "UR_FUNCTION_VIRTUAL_MEM_RESERVE"; break; - case UR_FUNCTION_VIRTUAL_MEM_FREE: os << "UR_FUNCTION_VIRTUAL_MEM_FREE"; break; - case UR_FUNCTION_VIRTUAL_MEM_MAP: os << "UR_FUNCTION_VIRTUAL_MEM_MAP"; break; - case UR_FUNCTION_VIRTUAL_MEM_UNMAP: os << "UR_FUNCTION_VIRTUAL_MEM_UNMAP"; break; - case UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS: os << "UR_FUNCTION_VIRTUAL_MEM_SET_ACCESS"; break; - case UR_FUNCTION_VIRTUAL_MEM_GET_INFO: os << "UR_FUNCTION_VIRTUAL_MEM_GET_INFO"; break; - case UR_FUNCTION_PHYSICAL_MEM_CREATE: os << "UR_FUNCTION_PHYSICAL_MEM_CREATE"; break; - case UR_FUNCTION_PHYSICAL_MEM_RETAIN: os << "UR_FUNCTION_PHYSICAL_MEM_RETAIN"; break; - case UR_FUNCTION_PHYSICAL_MEM_RELEASE: os << "UR_FUNCTION_PHYSICAL_MEM_RELEASE"; break; - case UR_FUNCTION_USM_IMPORT_EXP: os << "UR_FUNCTION_USM_IMPORT_EXP"; break; - case UR_FUNCTION_USM_RELEASE_EXP: os << "UR_FUNCTION_USM_RELEASE_EXP"; break; - case UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP: os << "UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP"; break; - case UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP: os << "UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP"; break; - case UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP: os << "UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP"; break; - case UR_FUNCTION_LOADER_CONFIG_CREATE: os << "UR_FUNCTION_LOADER_CONFIG_CREATE"; break; - case UR_FUNCTION_LOADER_CONFIG_RELEASE: os << "UR_FUNCTION_LOADER_CONFIG_RELEASE"; break; - case UR_FUNCTION_LOADER_CONFIG_RETAIN: os << "UR_FUNCTION_LOADER_CONFIG_RETAIN"; break; - case UR_FUNCTION_LOADER_CONFIG_GET_INFO: os << "UR_FUNCTION_LOADER_CONFIG_GET_INFO"; break; - case UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER: os << "UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER"; break; - case UR_FUNCTION_ADAPTER_RELEASE: os << "UR_FUNCTION_ADAPTER_RELEASE"; break; - case UR_FUNCTION_ADAPTER_GET: os << "UR_FUNCTION_ADAPTER_GET"; break; - case UR_FUNCTION_ADAPTER_RETAIN: os << "UR_FUNCTION_ADAPTER_RETAIN"; break; - case UR_FUNCTION_ADAPTER_GET_LAST_ERROR: os << "UR_FUNCTION_ADAPTER_GET_LAST_ERROR"; break; - case UR_FUNCTION_ADAPTER_GET_INFO: os << "UR_FUNCTION_ADAPTER_GET_INFO"; break; - case UR_FUNCTION_LOADER_INIT: os << "UR_FUNCTION_LOADER_INIT"; break; - case UR_FUNCTION_LOADER_TEAR_DOWN: os << "UR_FUNCTION_LOADER_TEAR_DOWN"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP"; break; - case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: os << "UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP"; break; - case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: os << "UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP"; break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP"; break; - case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: os << "UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK"; break; @@ -1205,174 +878,135 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_function_t value) { } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_structure_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_structure_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value) { switch (value) { - case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: os << "UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_IMAGE_DESC: os << "UR_STRUCTURE_TYPE_IMAGE_DESC"; break; - case UR_STRUCTURE_TYPE_BUFFER_PROPERTIES: os << "UR_STRUCTURE_TYPE_BUFFER_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_BUFFER_REGION: os << "UR_STRUCTURE_TYPE_BUFFER_REGION"; break; - case UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES: os << "UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES: os << "UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES: os << "UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_USM_DESC: os << "UR_STRUCTURE_TYPE_USM_DESC"; break; - case UR_STRUCTURE_TYPE_USM_HOST_DESC: os << "UR_STRUCTURE_TYPE_USM_HOST_DESC"; break; - case UR_STRUCTURE_TYPE_USM_DEVICE_DESC: os << "UR_STRUCTURE_TYPE_USM_DEVICE_DESC"; break; - case UR_STRUCTURE_TYPE_USM_POOL_DESC: os << "UR_STRUCTURE_TYPE_USM_POOL_DESC"; break; - case UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC: os << "UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC"; break; - case UR_STRUCTURE_TYPE_DEVICE_BINARY: os << "UR_STRUCTURE_TYPE_DEVICE_BINARY"; break; - case UR_STRUCTURE_TYPE_SAMPLER_DESC: os << "UR_STRUCTURE_TYPE_SAMPLER_DESC"; break; - case UR_STRUCTURE_TYPE_QUEUE_PROPERTIES: os << "UR_STRUCTURE_TYPE_QUEUE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES: os << "UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES: os << "UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC: os << "UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC"; break; - case UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES: os << "UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES: os << "UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: os << "UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: os << "UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC"; break; - case UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES: os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC: os << "UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC"; break; - case UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC: os << "UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC"; break; - case UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR: os << "UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR"; break; - case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: os << "UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE"; break; - case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: os << "UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES"; break; - case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES"; break; @@ -1382,19 +1016,19 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline void printStruct(std::ostream &os, const void *ptr) { +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_structure_type_t struct +inline ur_result_t printStruct(std::ostream &os, const void *ptr) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } - const enum ur_structure_type_t *value = - (const enum ur_structure_type_t *)ptr; + const enum ur_structure_type_t *value = (const enum ur_structure_type_t *)ptr; switch (*value) { case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: { - const ur_context_properties_t *pstruct = - (const ur_context_properties_t *)ptr; + const ur_context_properties_t *pstruct = (const ur_context_properties_t *)ptr; printPtr(os, pstruct); } break; @@ -1404,8 +1038,7 @@ inline void printStruct(std::ostream &os, const void *ptr) { } break; case UR_STRUCTURE_TYPE_BUFFER_PROPERTIES: { - const ur_buffer_properties_t *pstruct = - (const ur_buffer_properties_t *)ptr; + const ur_buffer_properties_t *pstruct = (const ur_buffer_properties_t *)ptr; printPtr(os, pstruct); } break; @@ -1415,20 +1048,17 @@ inline void printStruct(std::ostream &os, const void *ptr) { } break; case UR_STRUCTURE_TYPE_BUFFER_CHANNEL_PROPERTIES: { - const ur_buffer_channel_properties_t *pstruct = - (const ur_buffer_channel_properties_t *)ptr; + const ur_buffer_channel_properties_t *pstruct = (const ur_buffer_channel_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_BUFFER_ALLOC_LOCATION_PROPERTIES: { - const ur_buffer_alloc_location_properties_t *pstruct = - (const ur_buffer_alloc_location_properties_t *)ptr; + const ur_buffer_alloc_location_properties_t *pstruct = (const ur_buffer_alloc_location_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PROGRAM_PROPERTIES: { - const ur_program_properties_t *pstruct = - (const ur_program_properties_t *)ptr; + const ur_program_properties_t *pstruct = (const ur_program_properties_t *)ptr; printPtr(os, pstruct); } break; @@ -1453,8 +1083,7 @@ inline void printStruct(std::ostream &os, const void *ptr) { } break; case UR_STRUCTURE_TYPE_USM_POOL_LIMITS_DESC: { - const ur_usm_pool_limits_desc_t *pstruct = - (const ur_usm_pool_limits_desc_t *)ptr; + const ur_usm_pool_limits_desc_t *pstruct = (const ur_usm_pool_limits_desc_t *)ptr; printPtr(os, pstruct); } break; @@ -1469,468 +1098,373 @@ inline void printStruct(std::ostream &os, const void *ptr) { } break; case UR_STRUCTURE_TYPE_QUEUE_PROPERTIES: { - const ur_queue_properties_t *pstruct = - (const ur_queue_properties_t *)ptr; + const ur_queue_properties_t *pstruct = (const ur_queue_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_INDEX_PROPERTIES: { - const ur_queue_index_properties_t *pstruct = - (const ur_queue_index_properties_t *)ptr; + const ur_queue_index_properties_t *pstruct = (const ur_queue_index_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_CONTEXT_NATIVE_PROPERTIES: { - const ur_context_native_properties_t *pstruct = - (const ur_context_native_properties_t *)ptr; + const ur_context_native_properties_t *pstruct = (const ur_context_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_NATIVE_PROPERTIES: { - const ur_kernel_native_properties_t *pstruct = - (const ur_kernel_native_properties_t *)ptr; + const ur_kernel_native_properties_t *pstruct = (const ur_kernel_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_NATIVE_PROPERTIES: { - const ur_queue_native_properties_t *pstruct = - (const ur_queue_native_properties_t *)ptr; + const ur_queue_native_properties_t *pstruct = (const ur_queue_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_MEM_NATIVE_PROPERTIES: { - const ur_mem_native_properties_t *pstruct = - (const ur_mem_native_properties_t *)ptr; + const ur_mem_native_properties_t *pstruct = (const ur_mem_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EVENT_NATIVE_PROPERTIES: { - const ur_event_native_properties_t *pstruct = - (const ur_event_native_properties_t *)ptr; + const ur_event_native_properties_t *pstruct = (const ur_event_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PLATFORM_NATIVE_PROPERTIES: { - const ur_platform_native_properties_t *pstruct = - (const ur_platform_native_properties_t *)ptr; + const ur_platform_native_properties_t *pstruct = (const ur_platform_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_NATIVE_PROPERTIES: { - const ur_device_native_properties_t *pstruct = - (const ur_device_native_properties_t *)ptr; + const ur_device_native_properties_t *pstruct = (const ur_device_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PROGRAM_NATIVE_PROPERTIES: { - const ur_program_native_properties_t *pstruct = - (const ur_program_native_properties_t *)ptr; + const ur_program_native_properties_t *pstruct = (const ur_program_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_SAMPLER_NATIVE_PROPERTIES: { - const ur_sampler_native_properties_t *pstruct = - (const ur_sampler_native_properties_t *)ptr; + const ur_sampler_native_properties_t *pstruct = (const ur_sampler_native_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC: { - const ur_queue_native_desc_t *pstruct = - (const ur_queue_native_desc_t *)ptr; + const ur_queue_native_desc_t *pstruct = (const ur_queue_native_desc_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_DEVICE_PARTITION_PROPERTIES: { - const ur_device_partition_properties_t *pstruct = - (const ur_device_partition_properties_t *)ptr; + const ur_device_partition_properties_t *pstruct = (const ur_device_partition_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_MEM_OBJ_PROPERTIES: { - const ur_kernel_arg_mem_obj_properties_t *pstruct = - (const ur_kernel_arg_mem_obj_properties_t *)ptr; + const ur_kernel_arg_mem_obj_properties_t *pstruct = (const ur_kernel_arg_mem_obj_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_PHYSICAL_MEM_PROPERTIES: { - const ur_physical_mem_properties_t *pstruct = - (const ur_physical_mem_properties_t *)ptr; + const ur_physical_mem_properties_t *pstruct = (const ur_physical_mem_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_POINTER_PROPERTIES: { - const ur_kernel_arg_pointer_properties_t *pstruct = - (const ur_kernel_arg_pointer_properties_t *)ptr; + const ur_kernel_arg_pointer_properties_t *pstruct = (const ur_kernel_arg_pointer_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_SAMPLER_PROPERTIES: { - const ur_kernel_arg_sampler_properties_t *pstruct = - (const ur_kernel_arg_sampler_properties_t *)ptr; + const ur_kernel_arg_sampler_properties_t *pstruct = (const ur_kernel_arg_sampler_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_EXEC_INFO_PROPERTIES: { - const ur_kernel_exec_info_properties_t *pstruct = - (const ur_kernel_exec_info_properties_t *)ptr; + const ur_kernel_exec_info_properties_t *pstruct = (const ur_kernel_exec_info_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_VALUE_PROPERTIES: { - const ur_kernel_arg_value_properties_t *pstruct = - (const ur_kernel_arg_value_properties_t *)ptr; + const ur_kernel_arg_value_properties_t *pstruct = (const ur_kernel_arg_value_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_KERNEL_ARG_LOCAL_PROPERTIES: { - const ur_kernel_arg_local_properties_t *pstruct = - (const ur_kernel_arg_local_properties_t *)ptr; + const ur_kernel_arg_local_properties_t *pstruct = (const ur_kernel_arg_local_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_COMMAND_BUFFER_DESC: { - const ur_exp_command_buffer_desc_t *pstruct = - (const ur_exp_command_buffer_desc_t *)ptr; + const ur_exp_command_buffer_desc_t *pstruct = (const ur_exp_command_buffer_desc_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_MIP_PROPERTIES: { - const ur_exp_sampler_mip_properties_t *pstruct = - (const ur_exp_sampler_mip_properties_t *)ptr; + const ur_exp_sampler_mip_properties_t *pstruct = (const ur_exp_sampler_mip_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_INTEROP_MEM_DESC: { - const ur_exp_interop_mem_desc_t *pstruct = - (const ur_exp_interop_mem_desc_t *)ptr; + const ur_exp_interop_mem_desc_t *pstruct = (const ur_exp_interop_mem_desc_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_INTEROP_SEMAPHORE_DESC: { - const ur_exp_interop_semaphore_desc_t *pstruct = - (const ur_exp_interop_semaphore_desc_t *)ptr; + const ur_exp_interop_semaphore_desc_t *pstruct = (const ur_exp_interop_semaphore_desc_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR: { - const ur_exp_file_descriptor_t *pstruct = - (const ur_exp_file_descriptor_t *)ptr; + const ur_exp_file_descriptor_t *pstruct = (const ur_exp_file_descriptor_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE: { - const ur_exp_win32_handle_t *pstruct = - (const ur_exp_win32_handle_t *)ptr; + const ur_exp_win32_handle_t *pstruct = (const ur_exp_win32_handle_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES: { - const ur_exp_layered_image_properties_t *pstruct = - (const ur_exp_layered_image_properties_t *)ptr; + const ur_exp_layered_image_properties_t *pstruct = (const ur_exp_layered_image_properties_t *)ptr; printPtr(os, pstruct); } break; case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: { - const ur_exp_sampler_addr_modes_t *pstruct = - (const ur_exp_sampler_addr_modes_t *)ptr; + const ur_exp_sampler_addr_modes_t *pstruct = (const ur_exp_sampler_addr_modes_t *)ptr; printPtr(os, pstruct); } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_result_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_result_t value) { switch (value) { - case UR_RESULT_SUCCESS: os << "UR_RESULT_SUCCESS"; break; - case UR_RESULT_ERROR_INVALID_OPERATION: os << "UR_RESULT_ERROR_INVALID_OPERATION"; break; - case UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES: os << "UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES"; break; - case UR_RESULT_ERROR_INVALID_QUEUE: os << "UR_RESULT_ERROR_INVALID_QUEUE"; break; - case UR_RESULT_ERROR_INVALID_VALUE: os << "UR_RESULT_ERROR_INVALID_VALUE"; break; - case UR_RESULT_ERROR_INVALID_CONTEXT: os << "UR_RESULT_ERROR_INVALID_CONTEXT"; break; - case UR_RESULT_ERROR_INVALID_PLATFORM: os << "UR_RESULT_ERROR_INVALID_PLATFORM"; break; - case UR_RESULT_ERROR_INVALID_BINARY: os << "UR_RESULT_ERROR_INVALID_BINARY"; break; - case UR_RESULT_ERROR_INVALID_PROGRAM: os << "UR_RESULT_ERROR_INVALID_PROGRAM"; break; - case UR_RESULT_ERROR_INVALID_SAMPLER: os << "UR_RESULT_ERROR_INVALID_SAMPLER"; break; - case UR_RESULT_ERROR_INVALID_BUFFER_SIZE: os << "UR_RESULT_ERROR_INVALID_BUFFER_SIZE"; break; - case UR_RESULT_ERROR_INVALID_MEM_OBJECT: os << "UR_RESULT_ERROR_INVALID_MEM_OBJECT"; break; - case UR_RESULT_ERROR_INVALID_EVENT: os << "UR_RESULT_ERROR_INVALID_EVENT"; break; - case UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST: os << "UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST"; break; - case UR_RESULT_ERROR_MISALIGNED_SUB_BUFFER_OFFSET: os << "UR_RESULT_ERROR_MISALIGNED_SUB_BUFFER_OFFSET"; break; - case UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE: os << "UR_RESULT_ERROR_INVALID_WORK_GROUP_SIZE"; break; - case UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE: os << "UR_RESULT_ERROR_COMPILER_NOT_AVAILABLE"; break; - case UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE: os << "UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE"; break; - case UR_RESULT_ERROR_DEVICE_NOT_FOUND: os << "UR_RESULT_ERROR_DEVICE_NOT_FOUND"; break; - case UR_RESULT_ERROR_INVALID_DEVICE: os << "UR_RESULT_ERROR_INVALID_DEVICE"; break; - case UR_RESULT_ERROR_DEVICE_LOST: os << "UR_RESULT_ERROR_DEVICE_LOST"; break; - case UR_RESULT_ERROR_DEVICE_REQUIRES_RESET: os << "UR_RESULT_ERROR_DEVICE_REQUIRES_RESET"; break; - case UR_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE: os << "UR_RESULT_ERROR_DEVICE_IN_LOW_POWER_STATE"; break; - case UR_RESULT_ERROR_DEVICE_PARTITION_FAILED: os << "UR_RESULT_ERROR_DEVICE_PARTITION_FAILED"; break; - case UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT: os << "UR_RESULT_ERROR_INVALID_DEVICE_PARTITION_COUNT"; break; - case UR_RESULT_ERROR_INVALID_WORK_ITEM_SIZE: os << "UR_RESULT_ERROR_INVALID_WORK_ITEM_SIZE"; break; - case UR_RESULT_ERROR_INVALID_WORK_DIMENSION: os << "UR_RESULT_ERROR_INVALID_WORK_DIMENSION"; break; - case UR_RESULT_ERROR_INVALID_KERNEL_ARGS: os << "UR_RESULT_ERROR_INVALID_KERNEL_ARGS"; break; - case UR_RESULT_ERROR_INVALID_KERNEL: os << "UR_RESULT_ERROR_INVALID_KERNEL"; break; - case UR_RESULT_ERROR_INVALID_KERNEL_NAME: os << "UR_RESULT_ERROR_INVALID_KERNEL_NAME"; break; - case UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX: os << "UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX"; break; - case UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE: os << "UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_SIZE"; break; - case UR_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE: os << "UR_RESULT_ERROR_INVALID_KERNEL_ATTRIBUTE_VALUE"; break; - case UR_RESULT_ERROR_INVALID_IMAGE_SIZE: os << "UR_RESULT_ERROR_INVALID_IMAGE_SIZE"; break; - case UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR: os << "UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR"; break; - case UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED: os << "UR_RESULT_ERROR_IMAGE_FORMAT_NOT_SUPPORTED"; break; - case UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE: os << "UR_RESULT_ERROR_MEM_OBJECT_ALLOCATION_FAILURE"; break; - case UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE: os << "UR_RESULT_ERROR_INVALID_PROGRAM_EXECUTABLE"; break; - case UR_RESULT_ERROR_UNINITIALIZED: os << "UR_RESULT_ERROR_UNINITIALIZED"; break; - case UR_RESULT_ERROR_OUT_OF_HOST_MEMORY: os << "UR_RESULT_ERROR_OUT_OF_HOST_MEMORY"; break; - case UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY: os << "UR_RESULT_ERROR_OUT_OF_DEVICE_MEMORY"; break; - case UR_RESULT_ERROR_OUT_OF_RESOURCES: os << "UR_RESULT_ERROR_OUT_OF_RESOURCES"; break; - case UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE: os << "UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE"; break; - case UR_RESULT_ERROR_PROGRAM_LINK_FAILURE: os << "UR_RESULT_ERROR_PROGRAM_LINK_FAILURE"; break; - case UR_RESULT_ERROR_UNSUPPORTED_VERSION: os << "UR_RESULT_ERROR_UNSUPPORTED_VERSION"; break; - case UR_RESULT_ERROR_UNSUPPORTED_FEATURE: os << "UR_RESULT_ERROR_UNSUPPORTED_FEATURE"; break; - case UR_RESULT_ERROR_INVALID_ARGUMENT: os << "UR_RESULT_ERROR_INVALID_ARGUMENT"; break; - case UR_RESULT_ERROR_INVALID_NULL_HANDLE: os << "UR_RESULT_ERROR_INVALID_NULL_HANDLE"; break; - case UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE: os << "UR_RESULT_ERROR_HANDLE_OBJECT_IN_USE"; break; - case UR_RESULT_ERROR_INVALID_NULL_POINTER: os << "UR_RESULT_ERROR_INVALID_NULL_POINTER"; break; - case UR_RESULT_ERROR_INVALID_SIZE: os << "UR_RESULT_ERROR_INVALID_SIZE"; break; - case UR_RESULT_ERROR_UNSUPPORTED_SIZE: os << "UR_RESULT_ERROR_UNSUPPORTED_SIZE"; break; - case UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT: os << "UR_RESULT_ERROR_UNSUPPORTED_ALIGNMENT"; break; - case UR_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT: os << "UR_RESULT_ERROR_INVALID_SYNCHRONIZATION_OBJECT"; break; - case UR_RESULT_ERROR_INVALID_ENUMERATION: os << "UR_RESULT_ERROR_INVALID_ENUMERATION"; break; - case UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION: os << "UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION"; break; - case UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT: os << "UR_RESULT_ERROR_UNSUPPORTED_IMAGE_FORMAT"; break; - case UR_RESULT_ERROR_INVALID_NATIVE_BINARY: os << "UR_RESULT_ERROR_INVALID_NATIVE_BINARY"; break; - case UR_RESULT_ERROR_INVALID_GLOBAL_NAME: os << "UR_RESULT_ERROR_INVALID_GLOBAL_NAME"; break; - case UR_RESULT_ERROR_INVALID_FUNCTION_NAME: os << "UR_RESULT_ERROR_INVALID_FUNCTION_NAME"; break; - case UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION: os << "UR_RESULT_ERROR_INVALID_GROUP_SIZE_DIMENSION"; break; - case UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION: os << "UR_RESULT_ERROR_INVALID_GLOBAL_WIDTH_DIMENSION"; break; - case UR_RESULT_ERROR_PROGRAM_UNLINKED: os << "UR_RESULT_ERROR_PROGRAM_UNLINKED"; break; - case UR_RESULT_ERROR_OVERLAPPING_REGIONS: os << "UR_RESULT_ERROR_OVERLAPPING_REGIONS"; break; - case UR_RESULT_ERROR_INVALID_HOST_PTR: os << "UR_RESULT_ERROR_INVALID_HOST_PTR"; break; - case UR_RESULT_ERROR_INVALID_USM_SIZE: os << "UR_RESULT_ERROR_INVALID_USM_SIZE"; break; - case UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE: os << "UR_RESULT_ERROR_OBJECT_ALLOCATION_FAILURE"; break; - case UR_RESULT_ERROR_ADAPTER_SPECIFIC: os << "UR_RESULT_ERROR_ADAPTER_SPECIFIC"; break; - case UR_RESULT_ERROR_LAYER_NOT_PRESENT: os << "UR_RESULT_ERROR_LAYER_NOT_PRESENT"; break; - case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP: os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP"; break; - case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP: os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_EXP"; break; - case UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP: os << "UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP"; break; - case UR_RESULT_ERROR_UNKNOWN: os << "UR_RESULT_ERROR_UNKNOWN"; break; @@ -1940,8 +1474,11 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_result_t value) { } return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_base_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_base_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_base_properties_t params) { os << "(struct ur_base_properties_t){"; os << ".stype = "; @@ -1951,13 +1488,17 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_base_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_base_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_base_desc_t params) { os << "(struct ur_base_desc_t){"; os << ".stype = "; @@ -1967,13 +1508,17 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_rect_offset_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_rect_offset_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_rect_offset_t params) { os << "(struct ur_rect_offset_t){"; os << ".x = "; @@ -1993,8 +1538,11 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_rect_region_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_rect_region_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_rect_region_t params) { os << "(struct ur_rect_region_t){"; os << ".width = "; @@ -2014,26 +1562,24 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_init_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_init_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_init_flag_t value) { switch (value) { - case UR_DEVICE_INIT_FLAG_GPU: os << "UR_DEVICE_INIT_FLAG_GPU"; break; - case UR_DEVICE_INIT_FLAG_CPU: os << "UR_DEVICE_INIT_FLAG_CPU"; break; - case UR_DEVICE_INIT_FLAG_FPGA: os << "UR_DEVICE_INIT_FLAG_FPGA"; break; - case UR_DEVICE_INIT_FLAG_MCA: os << "UR_DEVICE_INIT_FLAG_MCA"; break; - case UR_DEVICE_INIT_FLAG_VPU: os << "UR_DEVICE_INIT_FLAG_VPU"; break; @@ -2044,8 +1590,11 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_init_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -2069,8 +1618,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_DEVICE_INIT_FLAG_CPU; } - if ((val & UR_DEVICE_INIT_FLAG_FPGA) == - (uint32_t)UR_DEVICE_INIT_FLAG_FPGA) { + if ((val & UR_DEVICE_INIT_FLAG_FPGA) == (uint32_t)UR_DEVICE_INIT_FLAG_FPGA) { val ^= (uint32_t)UR_DEVICE_INIT_FLAG_FPGA; if (!first) { os << " | "; @@ -2108,15 +1656,18 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_loader_config_info_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_loader_config_info_t value) { switch (value) { - case UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS: os << "UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS"; break; - case UR_LOADER_CONFIG_INFO_REFERENCE_COUNT: os << "UR_LOADER_CONFIG_INFO_REFERENCE_COUNT"; break; @@ -2126,28 +1677,26 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_loader_config_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_loader_config_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_loader_config_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_LOADER_CONFIG_INFO_AVAILABLE_LAYERS: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_LOADER_CONFIG_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -2157,22 +1706,29 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - const struct ur_code_location_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_code_location_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_code_location_t params) { os << "(struct ur_code_location_t){"; os << ".functionName = "; - ur_params::serializePtr(os, (params.functionName)); + details::printPtr(os, + (params.functionName)); os << ", "; os << ".sourceFile = "; - ur_params::serializePtr(os, (params.sourceFile)); + details::printPtr(os, + (params.sourceFile)); os << ", "; os << ".lineNumber = "; @@ -2187,14 +1743,15 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_adapter_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_adapter_info_t value) { switch (value) { - case UR_ADAPTER_INFO_BACKEND: os << "UR_ADAPTER_INFO_BACKEND"; break; - case UR_ADAPTER_INFO_REFERENCE_COUNT: os << "UR_ADAPTER_INFO_REFERENCE_COUNT"; break; @@ -2204,22 +1761,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_adapter_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_adapter_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_adapter_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_ADAPTER_INFO_BACKEND: { const ur_adapter_backend_t *tptr = (const ur_adapter_backend_t *)ptr; if (sizeof(ur_adapter_backend_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_adapter_backend_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_adapter_backend_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -2227,13 +1783,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_ADAPTER_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -2243,34 +1797,33 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_adapter_backend_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_backend_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_adapter_backend_t value) { switch (value) { - case UR_ADAPTER_BACKEND_UNKNOWN: os << "UR_ADAPTER_BACKEND_UNKNOWN"; break; - case UR_ADAPTER_BACKEND_LEVEL_ZERO: os << "UR_ADAPTER_BACKEND_LEVEL_ZERO"; break; - case UR_ADAPTER_BACKEND_OPENCL: os << "UR_ADAPTER_BACKEND_OPENCL"; break; - case UR_ADAPTER_BACKEND_CUDA: os << "UR_ADAPTER_BACKEND_CUDA"; break; - case UR_ADAPTER_BACKEND_HIP: os << "UR_ADAPTER_BACKEND_HIP"; break; - case UR_ADAPTER_BACKEND_NATIVE_CPU: os << "UR_ADAPTER_BACKEND_NATIVE_CPU"; break; @@ -2280,30 +1833,27 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_platform_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_platform_info_t value) { switch (value) { - case UR_PLATFORM_INFO_NAME: os << "UR_PLATFORM_INFO_NAME"; break; - case UR_PLATFORM_INFO_VENDOR_NAME: os << "UR_PLATFORM_INFO_VENDOR_NAME"; break; - case UR_PLATFORM_INFO_VERSION: os << "UR_PLATFORM_INFO_VERSION"; break; - case UR_PLATFORM_INFO_EXTENSIONS: os << "UR_PLATFORM_INFO_EXTENSIONS"; break; - case UR_PLATFORM_INFO_PROFILE: os << "UR_PLATFORM_INFO_PROFILE"; break; - case UR_PLATFORM_INFO_BACKEND: os << "UR_PLATFORM_INFO_BACKEND"; break; @@ -2313,52 +1863,46 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_platform_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_platform_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_platform_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_PLATFORM_INFO_NAME: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PLATFORM_INFO_VENDOR_NAME: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PLATFORM_INFO_VERSION: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PLATFORM_INFO_EXTENSIONS: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PLATFORM_INFO_PROFILE: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PLATFORM_INFO_BACKEND: { const ur_platform_backend_t *tptr = (const ur_platform_backend_t *)ptr; if (sizeof(ur_platform_backend_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_platform_backend_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_platform_backend_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -2368,17 +1912,25 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, enum ur_api_version_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_api_version_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_api_version_t value) { os << UR_MAJOR_VERSION(value) << "." << UR_MINOR_VERSION(value); return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_platform_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_platform_native_properties_t params) { os << "(struct ur_platform_native_properties_t){"; os << ".stype = "; @@ -2388,7 +1940,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -2398,30 +1951,27 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_platform_backend_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_backend_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_platform_backend_t value) { switch (value) { - case UR_PLATFORM_BACKEND_UNKNOWN: os << "UR_PLATFORM_BACKEND_UNKNOWN"; break; - case UR_PLATFORM_BACKEND_LEVEL_ZERO: os << "UR_PLATFORM_BACKEND_LEVEL_ZERO"; break; - case UR_PLATFORM_BACKEND_OPENCL: os << "UR_PLATFORM_BACKEND_OPENCL"; break; - case UR_PLATFORM_BACKEND_CUDA: os << "UR_PLATFORM_BACKEND_CUDA"; break; - case UR_PLATFORM_BACKEND_HIP: os << "UR_PLATFORM_BACKEND_HIP"; break; - case UR_PLATFORM_BACKEND_NATIVE_CPU: os << "UR_PLATFORM_BACKEND_NATIVE_CPU"; break; @@ -2431,8 +1981,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_device_binary_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_binary_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_device_binary_t params) { os << "(struct ur_device_binary_t){"; os << ".stype = "; @@ -2442,43 +1995,42 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".pDeviceTargetSpec = "; - printPtr(os, (params.pDeviceTargetSpec)); + details::printPtr(os, + (params.pDeviceTargetSpec)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_type_t value) { switch (value) { - case UR_DEVICE_TYPE_DEFAULT: os << "UR_DEVICE_TYPE_DEFAULT"; break; - case UR_DEVICE_TYPE_ALL: os << "UR_DEVICE_TYPE_ALL"; break; - case UR_DEVICE_TYPE_GPU: os << "UR_DEVICE_TYPE_GPU"; break; - case UR_DEVICE_TYPE_CPU: os << "UR_DEVICE_TYPE_CPU"; break; - case UR_DEVICE_TYPE_FPGA: os << "UR_DEVICE_TYPE_FPGA"; break; - case UR_DEVICE_TYPE_MCA: os << "UR_DEVICE_TYPE_MCA"; break; - case UR_DEVICE_TYPE_VPU: os << "UR_DEVICE_TYPE_VPU"; break; @@ -2488,533 +2040,405 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_type_t value) { } return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_info_t value) { switch (value) { - case UR_DEVICE_INFO_TYPE: os << "UR_DEVICE_INFO_TYPE"; break; - case UR_DEVICE_INFO_VENDOR_ID: os << "UR_DEVICE_INFO_VENDOR_ID"; break; - case UR_DEVICE_INFO_DEVICE_ID: os << "UR_DEVICE_INFO_DEVICE_ID"; break; - case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: os << "UR_DEVICE_INFO_MAX_COMPUTE_UNITS"; break; - case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: os << "UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS"; break; - case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: os << "UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES"; break; - case UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE: os << "UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE"; break; - case UR_DEVICE_INFO_SINGLE_FP_CONFIG: os << "UR_DEVICE_INFO_SINGLE_FP_CONFIG"; break; - case UR_DEVICE_INFO_HALF_FP_CONFIG: os << "UR_DEVICE_INFO_HALF_FP_CONFIG"; break; - case UR_DEVICE_INFO_DOUBLE_FP_CONFIG: os << "UR_DEVICE_INFO_DOUBLE_FP_CONFIG"; break; - case UR_DEVICE_INFO_QUEUE_PROPERTIES: os << "UR_DEVICE_INFO_QUEUE_PROPERTIES"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE"; break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF: os << "UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE"; break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF: os << "UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF"; break; - case UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY: os << "UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY"; break; - case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: os << "UR_DEVICE_INFO_MEMORY_CLOCK_RATE"; break; - case UR_DEVICE_INFO_ADDRESS_BITS: os << "UR_DEVICE_INFO_ADDRESS_BITS"; break; - case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: os << "UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE"; break; - case UR_DEVICE_INFO_IMAGE_SUPPORTED: os << "UR_DEVICE_INFO_IMAGE_SUPPORTED"; break; - case UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS: os << "UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS"; break; - case UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS: os << "UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS"; break; - case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS: os << "UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS"; break; - case UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH: os << "UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH"; break; - case UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT: os << "UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT"; break; - case UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH: os << "UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH"; break; - case UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT: os << "UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT"; break; - case UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH: os << "UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH"; break; - case UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE: os << "UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE"; break; - case UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE: os << "UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE"; break; - case UR_DEVICE_INFO_MAX_SAMPLERS: os << "UR_DEVICE_INFO_MAX_SAMPLERS"; break; - case UR_DEVICE_INFO_MAX_PARAMETER_SIZE: os << "UR_DEVICE_INFO_MAX_PARAMETER_SIZE"; break; - case UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN: os << "UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN"; break; - case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE: os << "UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE"; break; - case UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE: os << "UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE"; break; - case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE: os << "UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE"; break; - case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: os << "UR_DEVICE_INFO_GLOBAL_MEM_SIZE"; break; - case UR_DEVICE_INFO_GLOBAL_MEM_FREE: os << "UR_DEVICE_INFO_GLOBAL_MEM_FREE"; break; - case UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE: os << "UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE"; break; - case UR_DEVICE_INFO_MAX_CONSTANT_ARGS: os << "UR_DEVICE_INFO_MAX_CONSTANT_ARGS"; break; - case UR_DEVICE_INFO_LOCAL_MEM_TYPE: os << "UR_DEVICE_INFO_LOCAL_MEM_TYPE"; break; - case UR_DEVICE_INFO_LOCAL_MEM_SIZE: os << "UR_DEVICE_INFO_LOCAL_MEM_SIZE"; break; - case UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT: os << "UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT"; break; - case UR_DEVICE_INFO_HOST_UNIFIED_MEMORY: os << "UR_DEVICE_INFO_HOST_UNIFIED_MEMORY"; break; - case UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION: os << "UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION"; break; - case UR_DEVICE_INFO_ENDIAN_LITTLE: os << "UR_DEVICE_INFO_ENDIAN_LITTLE"; break; - case UR_DEVICE_INFO_AVAILABLE: os << "UR_DEVICE_INFO_AVAILABLE"; break; - case UR_DEVICE_INFO_COMPILER_AVAILABLE: os << "UR_DEVICE_INFO_COMPILER_AVAILABLE"; break; - case UR_DEVICE_INFO_LINKER_AVAILABLE: os << "UR_DEVICE_INFO_LINKER_AVAILABLE"; break; - case UR_DEVICE_INFO_EXECUTION_CAPABILITIES: os << "UR_DEVICE_INFO_EXECUTION_CAPABILITIES"; break; - case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES: os << "UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES"; break; - case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: os << "UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES"; break; - case UR_DEVICE_INFO_BUILT_IN_KERNELS: os << "UR_DEVICE_INFO_BUILT_IN_KERNELS"; break; - case UR_DEVICE_INFO_PLATFORM: os << "UR_DEVICE_INFO_PLATFORM"; break; - case UR_DEVICE_INFO_REFERENCE_COUNT: os << "UR_DEVICE_INFO_REFERENCE_COUNT"; break; - case UR_DEVICE_INFO_IL_VERSION: os << "UR_DEVICE_INFO_IL_VERSION"; break; - case UR_DEVICE_INFO_NAME: os << "UR_DEVICE_INFO_NAME"; break; - case UR_DEVICE_INFO_VENDOR: os << "UR_DEVICE_INFO_VENDOR"; break; - case UR_DEVICE_INFO_DRIVER_VERSION: os << "UR_DEVICE_INFO_DRIVER_VERSION"; break; - case UR_DEVICE_INFO_PROFILE: os << "UR_DEVICE_INFO_PROFILE"; break; - case UR_DEVICE_INFO_VERSION: os << "UR_DEVICE_INFO_VERSION"; break; - case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: os << "UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION"; break; - case UR_DEVICE_INFO_EXTENSIONS: os << "UR_DEVICE_INFO_EXTENSIONS"; break; - case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE: os << "UR_DEVICE_INFO_PRINTF_BUFFER_SIZE"; break; - case UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC: os << "UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC"; break; - case UR_DEVICE_INFO_PARENT_DEVICE: os << "UR_DEVICE_INFO_PARENT_DEVICE"; break; - case UR_DEVICE_INFO_SUPPORTED_PARTITIONS: os << "UR_DEVICE_INFO_SUPPORTED_PARTITIONS"; break; - case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: os << "UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES"; break; - case UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: os << "UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN"; break; - case UR_DEVICE_INFO_PARTITION_TYPE: os << "UR_DEVICE_INFO_PARTITION_TYPE"; break; - case UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS: os << "UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS"; break; - case UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: os << "UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS"; break; - case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: os << "UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL"; break; - case UR_DEVICE_INFO_USM_HOST_SUPPORT: os << "UR_DEVICE_INFO_USM_HOST_SUPPORT"; break; - case UR_DEVICE_INFO_USM_DEVICE_SUPPORT: os << "UR_DEVICE_INFO_USM_DEVICE_SUPPORT"; break; - case UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT: os << "UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT"; break; - case UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT: os << "UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT"; break; - case UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT: os << "UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT"; break; - case UR_DEVICE_INFO_UUID: os << "UR_DEVICE_INFO_UUID"; break; - case UR_DEVICE_INFO_PCI_ADDRESS: os << "UR_DEVICE_INFO_PCI_ADDRESS"; break; - case UR_DEVICE_INFO_GPU_EU_COUNT: os << "UR_DEVICE_INFO_GPU_EU_COUNT"; break; - case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH: os << "UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH"; break; - case UR_DEVICE_INFO_GPU_EU_SLICES: os << "UR_DEVICE_INFO_GPU_EU_SLICES"; break; - case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE: os << "UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE"; break; - case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE: os << "UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE"; break; - case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU: os << "UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU"; break; - case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH: os << "UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH"; break; - case UR_DEVICE_INFO_IMAGE_SRGB: os << "UR_DEVICE_INFO_IMAGE_SRGB"; break; - case UR_DEVICE_INFO_BUILD_ON_SUBDEVICE: os << "UR_DEVICE_INFO_BUILD_ON_SUBDEVICE"; break; - case UR_DEVICE_INFO_ATOMIC_64: os << "UR_DEVICE_INFO_ATOMIC_64"; break; - case UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: os << "UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES"; break; - case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: os << "UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES"; break; - case UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: os << "UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES"; break; - case UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: os << "UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES"; break; - case UR_DEVICE_INFO_BFLOAT16: os << "UR_DEVICE_INFO_BFLOAT16"; break; - case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: os << "UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES"; break; - case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS: os << "UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS"; break; - case UR_DEVICE_INFO_MEMORY_BUS_WIDTH: os << "UR_DEVICE_INFO_MEMORY_BUS_WIDTH"; break; - case UR_DEVICE_INFO_MAX_WORK_GROUPS_3D: os << "UR_DEVICE_INFO_MAX_WORK_GROUPS_3D"; break; - case UR_DEVICE_INFO_ASYNC_BARRIER: os << "UR_DEVICE_INFO_ASYNC_BARRIER"; break; - case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT: os << "UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT"; break; - case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED: os << "UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED"; break; - case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: os << "UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP"; break; - case UR_DEVICE_INFO_IP_VERSION: os << "UR_DEVICE_INFO_IP_VERSION"; break; - case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: os << "UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT"; break; - case UR_DEVICE_INFO_ESIMD_SUPPORT: os << "UR_DEVICE_INFO_ESIMD_SUPPORT"; break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: os << "UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: os << "UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: os << "UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: os << "UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP"; break; - case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: os << "UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP"; break; - case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: os << "UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP"; break; - case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: os << "UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP"; break; - case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: os << "UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: os << "UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: os << "UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP"; break; - case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: os << "UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP: os << "UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP: os << "UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP: os << "UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP"; break; - case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP: os << "UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP"; break; @@ -3024,22 +2448,21 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_device_info_t value) { } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_device_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_DEVICE_INFO_TYPE: { const ur_device_type_t *tptr = (const ur_device_type_t *)ptr; if (sizeof(ur_device_type_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_type_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3047,13 +2470,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_VENDOR_ID: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3061,13 +2482,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_DEVICE_ID: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3075,13 +2494,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_COMPUTE_UNITS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3089,13 +2506,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_WORK_ITEM_DIMENSIONS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3103,7 +2518,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: { const size_t *tptr = (const size_t *)ptr; @@ -3118,13 +2532,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_DEVICE_INFO_MAX_WORK_GROUP_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3132,75 +2544,63 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_SINGLE_FP_CONFIG: { - const ur_device_fp_capability_flags_t *tptr = - (const ur_device_fp_capability_flags_t *)ptr; + const ur_device_fp_capability_flags_t *tptr = (const ur_device_fp_capability_flags_t *)ptr; if (sizeof(ur_device_fp_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_HALF_FP_CONFIG: { - const ur_device_fp_capability_flags_t *tptr = - (const ur_device_fp_capability_flags_t *)ptr; + const ur_device_fp_capability_flags_t *tptr = (const ur_device_fp_capability_flags_t *)ptr; if (sizeof(ur_device_fp_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_DOUBLE_FP_CONFIG: { - const ur_device_fp_capability_flags_t *tptr = - (const ur_device_fp_capability_flags_t *)ptr; + const ur_device_fp_capability_flags_t *tptr = (const ur_device_fp_capability_flags_t *)ptr; if (sizeof(ur_device_fp_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_fp_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_QUEUE_PROPERTIES: { const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; if (sizeof(ur_queue_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_CHAR: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3208,13 +2608,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_SHORT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3222,13 +2620,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_INT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3236,13 +2632,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_LONG: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3250,13 +2644,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_FLOAT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3264,13 +2656,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_DOUBLE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3278,13 +2668,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_VECTOR_WIDTH_HALF: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3292,13 +2680,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_CHAR: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3306,13 +2692,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_SHORT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3320,13 +2704,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_INT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3334,13 +2716,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_LONG: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3348,13 +2728,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_FLOAT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3362,13 +2740,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_DOUBLE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3376,13 +2752,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_NATIVE_VECTOR_WIDTH_HALF: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3390,13 +2764,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_CLOCK_FREQUENCY: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3404,13 +2776,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3418,13 +2788,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_ADDRESS_BITS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3432,13 +2800,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3446,13 +2812,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE_SUPPORTED: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3460,13 +2824,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_READ_IMAGE_ARGS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3474,13 +2836,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_WRITE_IMAGE_ARGS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3488,13 +2848,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_READ_WRITE_IMAGE_ARGS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3502,13 +2860,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE2D_MAX_WIDTH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3516,13 +2872,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE2D_MAX_HEIGHT: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3530,13 +2884,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE3D_MAX_WIDTH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3544,13 +2896,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE3D_MAX_HEIGHT: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3558,13 +2908,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE3D_MAX_DEPTH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3572,13 +2920,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE_MAX_BUFFER_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3586,13 +2932,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE_MAX_ARRAY_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3600,13 +2944,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_SAMPLERS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3614,13 +2956,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_PARAMETER_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3628,13 +2968,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MEM_BASE_ADDR_ALIGN: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3642,14 +2980,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_TYPE: { - const ur_device_mem_cache_type_t *tptr = - (const ur_device_mem_cache_type_t *)ptr; + const ur_device_mem_cache_type_t *tptr = (const ur_device_mem_cache_type_t *)ptr; if (sizeof(ur_device_mem_cache_type_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_mem_cache_type_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_mem_cache_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3657,13 +2992,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GLOBAL_MEM_CACHELINE_SIZE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3671,13 +3004,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GLOBAL_MEM_CACHE_SIZE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3685,13 +3016,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3699,13 +3028,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GLOBAL_MEM_FREE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3713,13 +3040,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_CONSTANT_BUFFER_SIZE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3727,13 +3052,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_CONSTANT_ARGS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3741,14 +3064,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_LOCAL_MEM_TYPE: { - const ur_device_local_mem_type_t *tptr = - (const ur_device_local_mem_type_t *)ptr; + const ur_device_local_mem_type_t *tptr = (const ur_device_local_mem_type_t *)ptr; if (sizeof(ur_device_local_mem_type_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_local_mem_type_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_local_mem_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3756,13 +3076,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_LOCAL_MEM_SIZE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3770,13 +3088,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3784,13 +3100,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_HOST_UNIFIED_MEMORY: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3798,13 +3112,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PROFILING_TIMER_RESOLUTION: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3812,13 +3124,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_ENDIAN_LITTLE: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3826,13 +3136,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_AVAILABLE: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3840,13 +3148,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_COMPILER_AVAILABLE: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3854,13 +3160,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_LINKER_AVAILABLE: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3868,77 +3172,68 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_EXECUTION_CAPABILITIES: { - const ur_device_exec_capability_flags_t *tptr = - (const ur_device_exec_capability_flags_t *)ptr; + const ur_device_exec_capability_flags_t *tptr = (const ur_device_exec_capability_flags_t *)ptr; if (sizeof(ur_device_exec_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_exec_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_exec_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_QUEUE_ON_DEVICE_PROPERTIES: { const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; if (sizeof(ur_queue_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_QUEUE_ON_HOST_PROPERTIES: { const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; if (sizeof(ur_queue_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_BUILT_IN_KERNELS: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_PLATFORM: { const ur_platform_handle_t *tptr = (const ur_platform_handle_t *)ptr; if (sizeof(ur_platform_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_platform_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_platform_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -3946,61 +3241,51 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IL_VERSION: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_NAME: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_VENDOR: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_DRIVER_VERSION: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_PROFILE: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_VERSION: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_BACKEND_RUNTIME_VERSION: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_EXTENSIONS: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4008,13 +3293,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4022,21 +3305,19 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PARENT_DEVICE: { const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; if (sizeof(ur_device_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_SUPPORTED_PARTITIONS: { const ur_device_partition_t *tptr = (const ur_device_partition_t *)ptr; @@ -4051,13 +3332,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_DEVICE_INFO_PARTITION_MAX_SUB_DEVICES: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4065,27 +3344,22 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_PARTITION_AFFINITY_DOMAIN: { - const ur_device_affinity_domain_flags_t *tptr = - (const ur_device_affinity_domain_flags_t *)ptr; + const ur_device_affinity_domain_flags_t *tptr = (const ur_device_affinity_domain_flags_t *)ptr; if (sizeof(ur_device_affinity_domain_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_affinity_domain_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_affinity_domain_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_PARTITION_TYPE: { - const ur_device_partition_property_t *tptr = - (const ur_device_partition_property_t *)ptr; + const ur_device_partition_property_t *tptr = (const ur_device_partition_property_t *)ptr; os << "{"; size_t nelems = size / sizeof(ur_device_partition_property_t); for (size_t i = 0; i < nelems; ++i) { @@ -4097,13 +3371,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_DEVICE_INFO_MAX_NUM_SUB_GROUPS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4111,13 +3383,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4125,7 +3395,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: { const uint32_t *tptr = (const uint32_t *)ptr; @@ -4140,100 +3409,86 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_DEVICE_INFO_USM_HOST_SUPPORT: { - const ur_device_usm_access_capability_flags_t *tptr = - (const ur_device_usm_access_capability_flags_t *)ptr; + const ur_device_usm_access_capability_flags_t *tptr = (const ur_device_usm_access_capability_flags_t *)ptr; if (sizeof(ur_device_usm_access_capability_flags_t) > size) { - os << "invalid size (is: " << size << ", expected: >=" - << sizeof(ur_device_usm_access_capability_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_USM_DEVICE_SUPPORT: { - const ur_device_usm_access_capability_flags_t *tptr = - (const ur_device_usm_access_capability_flags_t *)ptr; + const ur_device_usm_access_capability_flags_t *tptr = (const ur_device_usm_access_capability_flags_t *)ptr; if (sizeof(ur_device_usm_access_capability_flags_t) > size) { - os << "invalid size (is: " << size << ", expected: >=" - << sizeof(ur_device_usm_access_capability_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_USM_SINGLE_SHARED_SUPPORT: { - const ur_device_usm_access_capability_flags_t *tptr = - (const ur_device_usm_access_capability_flags_t *)ptr; + const ur_device_usm_access_capability_flags_t *tptr = (const ur_device_usm_access_capability_flags_t *)ptr; if (sizeof(ur_device_usm_access_capability_flags_t) > size) { - os << "invalid size (is: " << size << ", expected: >=" - << sizeof(ur_device_usm_access_capability_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_USM_CROSS_SHARED_SUPPORT: { - const ur_device_usm_access_capability_flags_t *tptr = - (const ur_device_usm_access_capability_flags_t *)ptr; + const ur_device_usm_access_capability_flags_t *tptr = (const ur_device_usm_access_capability_flags_t *)ptr; if (sizeof(ur_device_usm_access_capability_flags_t) > size) { - os << "invalid size (is: " << size << ", expected: >=" - << sizeof(ur_device_usm_access_capability_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_USM_SYSTEM_SHARED_SUPPORT: { - const ur_device_usm_access_capability_flags_t *tptr = - (const ur_device_usm_access_capability_flags_t *)ptr; + const ur_device_usm_access_capability_flags_t *tptr = (const ur_device_usm_access_capability_flags_t *)ptr; if (sizeof(ur_device_usm_access_capability_flags_t) > size) { - os << "invalid size (is: " << size << ", expected: >=" - << sizeof(ur_device_usm_access_capability_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_usm_access_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_UUID: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_PCI_ADDRESS: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_DEVICE_INFO_GPU_EU_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4241,13 +3496,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GPU_EU_SIMD_WIDTH: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4255,13 +3508,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GPU_EU_SLICES: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4269,13 +3520,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4283,13 +3532,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4297,13 +3544,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4311,13 +3556,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4325,13 +3568,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE_SRGB: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4339,13 +3580,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_BUILD_ON_SUBDEVICE: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4353,13 +3592,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_ATOMIC_64: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4367,77 +3604,63 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: { - const ur_memory_order_capability_flags_t *tptr = - (const ur_memory_order_capability_flags_t *)ptr; + const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr; if (sizeof(ur_memory_order_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: { - const ur_memory_scope_capability_flags_t *tptr = - (const ur_memory_scope_capability_flags_t *)ptr; + const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr; if (sizeof(ur_memory_scope_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: { - const ur_memory_order_capability_flags_t *tptr = - (const ur_memory_order_capability_flags_t *)ptr; + const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr; if (sizeof(ur_memory_order_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: { - const ur_memory_scope_capability_flags_t *tptr = - (const ur_memory_scope_capability_flags_t *)ptr; + const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr; if (sizeof(ur_memory_scope_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_DEVICE_INFO_BFLOAT16: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4445,13 +3668,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4459,13 +3680,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4473,13 +3692,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MEMORY_BUS_WIDTH: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4487,7 +3704,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_WORK_GROUPS_3D: { const size_t *tptr = (const size_t *)ptr; @@ -4502,13 +3718,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_DEVICE_INFO_ASYNC_BARRIER: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4516,13 +3730,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MEM_CHANNEL_SUPPORT: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4530,13 +3742,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_HOST_PIPE_READ_WRITE_SUPPORTED: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4544,13 +3754,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_REGISTERS_PER_WORK_GROUP: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4558,13 +3766,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IP_VERSION: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4572,13 +3778,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4586,13 +3790,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_ESIMD_SUPPORT: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4600,13 +3802,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4614,13 +3814,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_SHARED_USM_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4628,13 +3826,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_1D_USM_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4642,13 +3838,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_BINDLESS_IMAGES_2D_USM_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4656,13 +3850,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_IMAGE_PITCH_ALIGN_EXP: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4670,13 +3862,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_WIDTH_EXP: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4684,13 +3874,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_HEIGHT_EXP: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4698,13 +3886,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MAX_IMAGE_LINEAR_PITCH_EXP: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4712,13 +3898,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MIPMAP_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4726,13 +3910,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MIPMAP_ANISOTROPY_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4740,13 +3922,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MIPMAP_MAX_ANISOTROPY_EXP: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4754,13 +3934,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_MIPMAP_LEVEL_REFERENCE_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4768,13 +3946,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_INTEROP_MEMORY_IMPORT_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4782,13 +3958,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_INTEROP_MEMORY_EXPORT_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4796,13 +3970,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_INTEROP_SEMAPHORE_IMPORT_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4810,13 +3982,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_DEVICE_INFO_INTEROP_SEMAPHORE_EXPORT_SUPPORT_EXP: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -4826,34 +3996,33 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_affinity_domain_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_affinity_domain_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_affinity_domain_flag_t value) { switch (value) { - case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA: os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA"; break; - case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE: os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE"; break; - case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE: os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE"; break; - case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE: os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE"; break; - case UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE: os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE"; break; - case UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE: os << "UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE"; break; @@ -4864,14 +4033,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_affinity_domain_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA) == - (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA) { + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA) == (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA) { val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA; if (!first) { os << " | "; @@ -4881,8 +4051,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_NUMA; } - if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE) == - (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE) { + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE) == (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE) { val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE; if (!first) { os << " | "; @@ -4892,8 +4061,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L4_CACHE; } - if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE) == - (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE) { + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE) == (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE) { val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE; if (!first) { os << " | "; @@ -4903,8 +4071,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L3_CACHE; } - if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE) == - (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE) { + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE) == (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE) { val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE; if (!first) { os << " | "; @@ -4914,8 +4081,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L2_CACHE; } - if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE) == - (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE) { + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE) == (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE) { val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE; if (!first) { os << " | "; @@ -4925,8 +4091,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_AFFINITY_DOMAIN_FLAG_L1_CACHE; } - if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE) == - (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE) { + if ((val & UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE) == (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE) { val ^= (uint32_t)UR_DEVICE_AFFINITY_DOMAIN_FLAG_NEXT_PARTITIONABLE; if (!first) { os << " | "; @@ -4944,23 +4109,24 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_partition_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_partition_t value) { switch (value) { - case UR_DEVICE_PARTITION_EQUALLY: os << "UR_DEVICE_PARTITION_EQUALLY"; break; - case UR_DEVICE_PARTITION_BY_COUNTS: os << "UR_DEVICE_PARTITION_BY_COUNTS"; break; - case UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN: os << "UR_DEVICE_PARTITION_BY_AFFINITY_DOMAIN"; break; - case UR_DEVICE_PARTITION_BY_CSLICE: os << "UR_DEVICE_PARTITION_BY_CSLICE"; break; @@ -4970,10 +4136,14 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { -inline void printUnion(std::ostream &os, - const union ur_device_partition_value_t params, - const enum ur_device_partition_t tag) { +/////////////////////////////////////////////////////////////////////////////// +// @brief Print ur_device_partition_value_t union +inline ur_result_t printUnion( + std::ostream &os, + const union ur_device_partition_value_t params, + const enum ur_device_partition_t tag) { os << "(union ur_device_partition_value_t){"; switch (tag) { @@ -4995,19 +4165,23 @@ inline void printUnion(std::ostream &os, os << ".affinity_domain = "; - printFlag(os, - (params.affinity_domain)); + details::printFlag(os, + (params.affinity_domain)); break; default: os << ""; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } os << "}"; -} -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_partition_property_t params) { + return UR_RESULT_SUCCESS; +} +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_property_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_device_partition_property_t params) { os << "(struct ur_device_partition_property_t){"; os << ".type = "; @@ -5016,14 +4190,16 @@ operator<<(std::ostream &os, os << ", "; os << ".value = "; - printUnion(os, (params.value), params.type); + details::printUnion(os, (params.value), params.type); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_partition_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_device_partition_properties_t params) { os << "(struct ur_device_partition_properties_t){"; os << ".stype = "; @@ -5033,12 +4209,14 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".pProperties = "; - printPtr(os, (params.pProperties)); + details::printPtr(os, + (params.pProperties)); os << ", "; os << ".PropCount = "; @@ -5048,38 +4226,33 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_fp_capability_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_fp_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_fp_capability_flag_t value) { switch (value) { - case UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT: os << "UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST: os << "UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO: os << "UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF: os << "UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN: os << "UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_DENORM: os << "UR_DEVICE_FP_CAPABILITY_FLAG_DENORM"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_FMA: os << "UR_DEVICE_FP_CAPABILITY_FLAG_FMA"; break; - case UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT: os << "UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT"; break; @@ -5090,16 +4263,16 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_fp_capability_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT) { - val ^= (uint32_t) - UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT; + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT) { + val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT; if (!first) { os << " | "; } else { @@ -5108,8 +4281,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_CORRECTLY_ROUNDED_DIVIDE_SQRT; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST; if (!first) { os << " | "; @@ -5119,8 +4291,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_NEAREST; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO; if (!first) { os << " | "; @@ -5130,8 +4301,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_ZERO; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF; if (!first) { os << " | "; @@ -5141,8 +4311,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_ROUND_TO_INF; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN; if (!first) { os << " | "; @@ -5152,8 +4321,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_INF_NAN; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_DENORM) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_DENORM) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_DENORM) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_DENORM) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_DENORM; if (!first) { os << " | "; @@ -5163,8 +4331,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_DENORM; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_FMA) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_FMA) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_FMA) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_FMA) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_FMA; if (!first) { os << " | "; @@ -5174,8 +4341,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_FP_CAPABILITY_FLAG_FMA; } - if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT) == - (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT) { + if ((val & UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT) == (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT) { val ^= (uint32_t)UR_DEVICE_FP_CAPABILITY_FLAG_SOFT_FLOAT; if (!first) { os << " | "; @@ -5193,19 +4359,21 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_mem_cache_type_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_mem_cache_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_mem_cache_type_t value) { switch (value) { - case UR_DEVICE_MEM_CACHE_TYPE_NONE: os << "UR_DEVICE_MEM_CACHE_TYPE_NONE"; break; - case UR_DEVICE_MEM_CACHE_TYPE_READ_ONLY_CACHE: os << "UR_DEVICE_MEM_CACHE_TYPE_READ_ONLY_CACHE"; break; - case UR_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE: os << "UR_DEVICE_MEM_CACHE_TYPE_READ_WRITE_CACHE"; break; @@ -5215,18 +4383,18 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_local_mem_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_local_mem_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_local_mem_type_t value) { switch (value) { - case UR_DEVICE_LOCAL_MEM_TYPE_NONE: os << "UR_DEVICE_LOCAL_MEM_TYPE_NONE"; break; - case UR_DEVICE_LOCAL_MEM_TYPE_LOCAL: os << "UR_DEVICE_LOCAL_MEM_TYPE_LOCAL"; break; - case UR_DEVICE_LOCAL_MEM_TYPE_GLOBAL: os << "UR_DEVICE_LOCAL_MEM_TYPE_GLOBAL"; break; @@ -5236,14 +4404,15 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_device_exec_capability_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_exec_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_exec_capability_flag_t value) { switch (value) { - case UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL: os << "UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL"; break; - case UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL: os << "UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL"; break; @@ -5254,14 +4423,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_exec_capability_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL) == - (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL) { + if ((val & UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL) == (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL) { val ^= (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL; if (!first) { os << " | "; @@ -5271,8 +4441,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_EXEC_CAPABILITY_FLAG_KERNEL; } - if ((val & UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL) == - (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL) { + if ((val & UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL) == (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL) { val ^= (uint32_t)UR_DEVICE_EXEC_CAPABILITY_FLAG_NATIVE_KERNEL; if (!first) { os << " | "; @@ -5290,10 +4459,14 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_device_native_properties_t params) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_device_native_properties_t params) { os << "(struct ur_device_native_properties_t){"; os << ".stype = "; @@ -5303,7 +4476,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5313,26 +4487,24 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_memory_order_capability_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_memory_order_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_memory_order_capability_flag_t value) { switch (value) { - case UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED: os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED"; break; - case UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE: os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE"; break; - case UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE: os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE"; break; - case UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL: os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL"; break; - case UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST: os << "UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST"; break; @@ -5343,14 +4515,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_memory_order_capability_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED) == - (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED) { + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED) == (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED) { val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED; if (!first) { os << " | "; @@ -5360,8 +4533,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_ORDER_CAPABILITY_FLAG_RELAXED; } - if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE) == - (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE) { + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE) == (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE) { val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE; if (!first) { os << " | "; @@ -5371,8 +4543,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQUIRE; } - if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE) == - (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE) { + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE) == (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE) { val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE; if (!first) { os << " | "; @@ -5382,8 +4553,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_ORDER_CAPABILITY_FLAG_RELEASE; } - if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL) == - (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL) { + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL) == (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL) { val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL; if (!first) { os << " | "; @@ -5393,8 +4563,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_ORDER_CAPABILITY_FLAG_ACQ_REL; } - if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST) == - (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST) { + if ((val & UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST) == (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST) { val ^= (uint32_t)UR_MEMORY_ORDER_CAPABILITY_FLAG_SEQ_CST; if (!first) { os << " | "; @@ -5412,27 +4581,27 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_memory_scope_capability_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_memory_scope_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_memory_scope_capability_flag_t value) { switch (value) { - case UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM: os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM"; break; - case UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP: os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP"; break; - case UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP: os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP"; break; - case UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE: os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE"; break; - case UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM: os << "UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM"; break; @@ -5443,14 +4612,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_memory_scope_capability_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM) == - (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM) { + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM) == (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM) { val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM; if (!first) { os << " | "; @@ -5460,8 +4630,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_ITEM; } - if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP) == - (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP) { + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP) == (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP) { val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP; if (!first) { os << " | "; @@ -5471,8 +4640,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_SUB_GROUP; } - if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP) == - (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP) { + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP) == (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP) { val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP; if (!first) { os << " | "; @@ -5482,8 +4650,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_WORK_GROUP; } - if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE) == - (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE) { + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE) == (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE) { val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE; if (!first) { os << " | "; @@ -5493,8 +4660,7 @@ inline void printFlag(std::ostream &os, os << UR_MEMORY_SCOPE_CAPABILITY_FLAG_DEVICE; } - if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM) == - (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM) { + if ((val & UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM) == (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM) { val ^= (uint32_t)UR_MEMORY_SCOPE_CAPABILITY_FLAG_SYSTEM; if (!first) { os << " | "; @@ -5512,24 +4678,24 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream & -operator<<(std::ostream &os, - enum ur_device_usm_access_capability_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_usm_access_capability_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_device_usm_access_capability_flag_t value) { switch (value) { - case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS: os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS"; break; - case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS: os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS"; break; - case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS: os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS"; break; - case UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS: os << "UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS"; break; @@ -5540,14 +4706,15 @@ operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_device_usm_access_capability_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS) == - (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS) { + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS) == (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS) { val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS; if (!first) { os << " | "; @@ -5557,8 +4724,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ACCESS; } - if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS) == - (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS) { + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS) == (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS) { val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS; if (!first) { os << " | "; @@ -5568,8 +4734,7 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_ACCESS; } - if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS) == - (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS) { + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS) == (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS) { val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS; if (!first) { os << " | "; @@ -5579,11 +4744,8 @@ inline void printFlag(std::ostream &os, os << UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_CONCURRENT_ACCESS; } - if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS) == - (uint32_t) - UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS) { - val ^= (uint32_t) - UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS; + if ((val & UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS) == (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS) { + val ^= (uint32_t)UR_DEVICE_USM_ACCESS_CAPABILITY_FLAG_ATOMIC_CONCURRENT_ACCESS; if (!first) { os << " | "; } else { @@ -5600,11 +4762,15 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_context_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_context_flag_t value) { switch (value) { - case UR_CONTEXT_FLAG_TBD: os << "UR_CONTEXT_FLAG_TBD"; break; @@ -5615,8 +4781,11 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5638,9 +4807,14 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_context_properties_t params) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_context_properties_t params) { os << "(struct ur_context_properties_t){"; os << ".stype = "; @@ -5650,52 +4824,48 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - printFlag(os, (params.flags)); + details::printFlag(os, + (params.flags)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_context_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_context_info_t value) { switch (value) { - case UR_CONTEXT_INFO_NUM_DEVICES: os << "UR_CONTEXT_INFO_NUM_DEVICES"; break; - case UR_CONTEXT_INFO_DEVICES: os << "UR_CONTEXT_INFO_DEVICES"; break; - case UR_CONTEXT_INFO_REFERENCE_COUNT: os << "UR_CONTEXT_INFO_REFERENCE_COUNT"; break; - case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT: os << "UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT"; break; - case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT: os << "UR_CONTEXT_INFO_USM_FILL2D_SUPPORT"; break; - case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES"; break; - case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: os << "UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES"; break; - case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: os << "UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES"; break; - case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: os << "UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES"; break; @@ -5705,22 +4875,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_context_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_context_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_CONTEXT_INFO_NUM_DEVICES: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -5728,7 +4897,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_CONTEXT_INFO_DEVICES: { const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; @@ -5739,17 +4907,16 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ", "; } - printPtr(os, tptr[i]); + details::printPtr(os, + tptr[i]); } os << "}"; } break; - case UR_CONTEXT_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -5757,13 +4924,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -5771,13 +4936,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_CONTEXT_INFO_USM_FILL2D_SUPPORT: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -5785,79 +4948,71 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: { - const ur_memory_order_capability_flags_t *tptr = - (const ur_memory_order_capability_flags_t *)ptr; + const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr; if (sizeof(ur_memory_order_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_CONTEXT_INFO_ATOMIC_MEMORY_SCOPE_CAPABILITIES: { - const ur_memory_scope_capability_flags_t *tptr = - (const ur_memory_scope_capability_flags_t *)ptr; + const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr; if (sizeof(ur_memory_scope_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_CONTEXT_INFO_ATOMIC_FENCE_ORDER_CAPABILITIES: { - const ur_memory_order_capability_flags_t *tptr = - (const ur_memory_order_capability_flags_t *)ptr; + const ur_memory_order_capability_flags_t *tptr = (const ur_memory_order_capability_flags_t *)ptr; if (sizeof(ur_memory_order_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_order_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_CONTEXT_INFO_ATOMIC_FENCE_SCOPE_CAPABILITIES: { - const ur_memory_scope_capability_flags_t *tptr = - (const ur_memory_scope_capability_flags_t *)ptr; + const ur_memory_scope_capability_flags_t *tptr = (const ur_memory_scope_capability_flags_t *)ptr; if (sizeof(ur_memory_scope_capability_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_memory_scope_capability_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_context_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_context_native_properties_t params) { os << "(struct ur_context_native_properties_t){"; os << ".stype = "; @@ -5867,7 +5022,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5877,29 +5033,27 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_mem_flag_t value) { switch (value) { - case UR_MEM_FLAG_READ_WRITE: os << "UR_MEM_FLAG_READ_WRITE"; break; - case UR_MEM_FLAG_WRITE_ONLY: os << "UR_MEM_FLAG_WRITE_ONLY"; break; - case UR_MEM_FLAG_READ_ONLY: os << "UR_MEM_FLAG_READ_ONLY"; break; - case UR_MEM_FLAG_USE_HOST_POINTER: os << "UR_MEM_FLAG_USE_HOST_POINTER"; break; - case UR_MEM_FLAG_ALLOC_HOST_POINTER: os << "UR_MEM_FLAG_ALLOC_HOST_POINTER"; break; - case UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER: os << "UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER"; break; @@ -5910,8 +5064,11 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_flag_t value) { return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -5945,8 +5102,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_MEM_FLAG_READ_ONLY; } - if ((val & UR_MEM_FLAG_USE_HOST_POINTER) == - (uint32_t)UR_MEM_FLAG_USE_HOST_POINTER) { + if ((val & UR_MEM_FLAG_USE_HOST_POINTER) == (uint32_t)UR_MEM_FLAG_USE_HOST_POINTER) { val ^= (uint32_t)UR_MEM_FLAG_USE_HOST_POINTER; if (!first) { os << " | "; @@ -5956,8 +5112,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_MEM_FLAG_USE_HOST_POINTER; } - if ((val & UR_MEM_FLAG_ALLOC_HOST_POINTER) == - (uint32_t)UR_MEM_FLAG_ALLOC_HOST_POINTER) { + if ((val & UR_MEM_FLAG_ALLOC_HOST_POINTER) == (uint32_t)UR_MEM_FLAG_ALLOC_HOST_POINTER) { val ^= (uint32_t)UR_MEM_FLAG_ALLOC_HOST_POINTER; if (!first) { os << " | "; @@ -5967,8 +5122,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_MEM_FLAG_ALLOC_HOST_POINTER; } - if ((val & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) == - (uint32_t)UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) { + if ((val & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) == (uint32_t)UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) { val ^= (uint32_t)UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER; if (!first) { os << " | "; @@ -5986,34 +5140,33 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_mem_type_t value) { switch (value) { - case UR_MEM_TYPE_BUFFER: os << "UR_MEM_TYPE_BUFFER"; break; - case UR_MEM_TYPE_IMAGE2D: os << "UR_MEM_TYPE_IMAGE2D"; break; - case UR_MEM_TYPE_IMAGE3D: os << "UR_MEM_TYPE_IMAGE3D"; break; - case UR_MEM_TYPE_IMAGE2D_ARRAY: os << "UR_MEM_TYPE_IMAGE2D_ARRAY"; break; - case UR_MEM_TYPE_IMAGE1D: os << "UR_MEM_TYPE_IMAGE1D"; break; - case UR_MEM_TYPE_IMAGE1D_ARRAY: os << "UR_MEM_TYPE_IMAGE1D_ARRAY"; break; - case UR_MEM_TYPE_IMAGE1D_BUFFER: os << "UR_MEM_TYPE_IMAGE1D_BUFFER"; break; @@ -6023,13 +5176,15 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_type_t value) { } return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_mem_info_t value) { switch (value) { - case UR_MEM_INFO_SIZE: os << "UR_MEM_INFO_SIZE"; break; - case UR_MEM_INFO_CONTEXT: os << "UR_MEM_INFO_CONTEXT"; break; @@ -6039,22 +5194,21 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_mem_info_t value) { } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_mem_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, - size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_MEM_INFO_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6062,86 +5216,75 @@ inline void printTagged(std::ostream &os, const void *ptr, ur_mem_info_t value, os << ")"; } break; - case UR_MEM_INFO_CONTEXT: { const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; if (sizeof(ur_context_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_image_channel_order_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_channel_order_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_image_channel_order_t value) { switch (value) { - case UR_IMAGE_CHANNEL_ORDER_A: os << "UR_IMAGE_CHANNEL_ORDER_A"; break; - case UR_IMAGE_CHANNEL_ORDER_R: os << "UR_IMAGE_CHANNEL_ORDER_R"; break; - case UR_IMAGE_CHANNEL_ORDER_RG: os << "UR_IMAGE_CHANNEL_ORDER_RG"; break; - case UR_IMAGE_CHANNEL_ORDER_RA: os << "UR_IMAGE_CHANNEL_ORDER_RA"; break; - case UR_IMAGE_CHANNEL_ORDER_RGB: os << "UR_IMAGE_CHANNEL_ORDER_RGB"; break; - case UR_IMAGE_CHANNEL_ORDER_RGBA: os << "UR_IMAGE_CHANNEL_ORDER_RGBA"; break; - case UR_IMAGE_CHANNEL_ORDER_BGRA: os << "UR_IMAGE_CHANNEL_ORDER_BGRA"; break; - case UR_IMAGE_CHANNEL_ORDER_ARGB: os << "UR_IMAGE_CHANNEL_ORDER_ARGB"; break; - case UR_IMAGE_CHANNEL_ORDER_ABGR: os << "UR_IMAGE_CHANNEL_ORDER_ABGR"; break; - case UR_IMAGE_CHANNEL_ORDER_INTENSITY: os << "UR_IMAGE_CHANNEL_ORDER_INTENSITY"; break; - case UR_IMAGE_CHANNEL_ORDER_LUMINANCE: os << "UR_IMAGE_CHANNEL_ORDER_LUMINANCE"; break; - case UR_IMAGE_CHANNEL_ORDER_RX: os << "UR_IMAGE_CHANNEL_ORDER_RX"; break; - case UR_IMAGE_CHANNEL_ORDER_RGX: os << "UR_IMAGE_CHANNEL_ORDER_RGX"; break; - case UR_IMAGE_CHANNEL_ORDER_RGBX: os << "UR_IMAGE_CHANNEL_ORDER_RGBX"; break; - case UR_IMAGE_CHANNEL_ORDER_SRGBA: os << "UR_IMAGE_CHANNEL_ORDER_SRGBA"; break; @@ -6151,66 +5294,54 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_image_channel_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_channel_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_image_channel_type_t value) { switch (value) { - case UR_IMAGE_CHANNEL_TYPE_SNORM_INT8: os << "UR_IMAGE_CHANNEL_TYPE_SNORM_INT8"; break; - case UR_IMAGE_CHANNEL_TYPE_SNORM_INT16: os << "UR_IMAGE_CHANNEL_TYPE_SNORM_INT16"; break; - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: os << "UR_IMAGE_CHANNEL_TYPE_UNORM_INT8"; break; - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: os << "UR_IMAGE_CHANNEL_TYPE_UNORM_INT16"; break; - case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565: os << "UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_565"; break; - case UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555: os << "UR_IMAGE_CHANNEL_TYPE_UNORM_SHORT_555"; break; - case UR_IMAGE_CHANNEL_TYPE_INT_101010: os << "UR_IMAGE_CHANNEL_TYPE_INT_101010"; break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: os << "UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8"; break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: os << "UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16"; break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: os << "UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32"; break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: os << "UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8"; break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: os << "UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16"; break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: os << "UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32"; break; - case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: os << "UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT"; break; - case UR_IMAGE_CHANNEL_TYPE_FLOAT: os << "UR_IMAGE_CHANNEL_TYPE_FLOAT"; break; @@ -6220,33 +5351,30 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_image_info_t value) { switch (value) { - case UR_IMAGE_INFO_FORMAT: os << "UR_IMAGE_INFO_FORMAT"; break; - case UR_IMAGE_INFO_ELEMENT_SIZE: os << "UR_IMAGE_INFO_ELEMENT_SIZE"; break; - case UR_IMAGE_INFO_ROW_PITCH: os << "UR_IMAGE_INFO_ROW_PITCH"; break; - case UR_IMAGE_INFO_SLICE_PITCH: os << "UR_IMAGE_INFO_SLICE_PITCH"; break; - case UR_IMAGE_INFO_WIDTH: os << "UR_IMAGE_INFO_WIDTH"; break; - case UR_IMAGE_INFO_HEIGHT: os << "UR_IMAGE_INFO_HEIGHT"; break; - case UR_IMAGE_INFO_DEPTH: os << "UR_IMAGE_INFO_DEPTH"; break; @@ -6256,22 +5384,21 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_image_info_t value) { } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_image_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_image_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_image_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_IMAGE_INFO_FORMAT: { const ur_image_format_t *tptr = (const ur_image_format_t *)ptr; if (sizeof(ur_image_format_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_image_format_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_image_format_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6279,13 +5406,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_IMAGE_INFO_ELEMENT_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6293,13 +5418,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_IMAGE_INFO_ROW_PITCH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6307,13 +5430,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_IMAGE_INFO_SLICE_PITCH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6321,13 +5442,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_IMAGE_INFO_WIDTH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6335,13 +5454,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_IMAGE_INFO_HEIGHT: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6349,13 +5466,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_IMAGE_INFO_DEPTH: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6365,12 +5480,17 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - const struct ur_image_format_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_format_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_image_format_t params) { os << "(struct ur_image_format_t){"; os << ".channelOrder = "; @@ -6385,8 +5505,11 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_image_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_image_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_image_desc_t params) { os << "(struct ur_image_desc_t){"; os << ".stype = "; @@ -6396,7 +5519,8 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".type = "; @@ -6446,8 +5570,11 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_buffer_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_properties_t params) { os << "(struct ur_buffer_properties_t){"; os << ".stype = "; @@ -6457,19 +5584,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".pHost = "; - printPtr(os, (params.pHost)); + details::printPtr(os, + (params.pHost)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_buffer_channel_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_channel_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_channel_properties_t params) { os << "(struct ur_buffer_channel_properties_t){"; os << ".stype = "; @@ -6479,7 +5610,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".channel = "; @@ -6489,9 +5621,11 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_buffer_alloc_location_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_alloc_location_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_alloc_location_properties_t params) { os << "(struct ur_buffer_alloc_location_properties_t){"; os << ".stype = "; @@ -6501,7 +5635,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".location = "; @@ -6511,8 +5646,11 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_buffer_region_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_region_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_region_t params) { os << "(struct ur_buffer_region_t){"; os << ".stype = "; @@ -6522,7 +5660,8 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".origin = "; @@ -6537,10 +5676,12 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_buffer_create_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_buffer_create_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_buffer_create_type_t value) { switch (value) { - case UR_BUFFER_CREATE_TYPE_REGION: os << "UR_BUFFER_CREATE_TYPE_REGION"; break; @@ -6550,8 +5691,11 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { os << "(struct ur_mem_native_properties_t){"; os << ".stype = "; @@ -6561,7 +5705,8 @@ operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -6571,14 +5716,15 @@ operator<<(std::ostream &os, const struct ur_mem_native_properties_t params) { os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_sampler_filter_mode_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_filter_mode_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_sampler_filter_mode_t value) { switch (value) { - case UR_SAMPLER_FILTER_MODE_NEAREST: os << "UR_SAMPLER_FILTER_MODE_NEAREST"; break; - case UR_SAMPLER_FILTER_MODE_LINEAR: os << "UR_SAMPLER_FILTER_MODE_LINEAR"; break; @@ -6588,26 +5734,24 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_sampler_addressing_mode_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_addressing_mode_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_sampler_addressing_mode_t value) { switch (value) { - case UR_SAMPLER_ADDRESSING_MODE_NONE: os << "UR_SAMPLER_ADDRESSING_MODE_NONE"; break; - case UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE: os << "UR_SAMPLER_ADDRESSING_MODE_CLAMP_TO_EDGE"; break; - case UR_SAMPLER_ADDRESSING_MODE_CLAMP: os << "UR_SAMPLER_ADDRESSING_MODE_CLAMP"; break; - case UR_SAMPLER_ADDRESSING_MODE_REPEAT: os << "UR_SAMPLER_ADDRESSING_MODE_REPEAT"; break; - case UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT: os << "UR_SAMPLER_ADDRESSING_MODE_MIRRORED_REPEAT"; break; @@ -6617,26 +5761,24 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_sampler_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_sampler_info_t value) { switch (value) { - case UR_SAMPLER_INFO_REFERENCE_COUNT: os << "UR_SAMPLER_INFO_REFERENCE_COUNT"; break; - case UR_SAMPLER_INFO_CONTEXT: os << "UR_SAMPLER_INFO_CONTEXT"; break; - case UR_SAMPLER_INFO_NORMALIZED_COORDS: os << "UR_SAMPLER_INFO_NORMALIZED_COORDS"; break; - case UR_SAMPLER_INFO_ADDRESSING_MODE: os << "UR_SAMPLER_INFO_ADDRESSING_MODE"; break; - case UR_SAMPLER_INFO_FILTER_MODE: os << "UR_SAMPLER_INFO_FILTER_MODE"; break; @@ -6646,22 +5788,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_sampler_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_sampler_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_sampler_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_SAMPLER_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6669,27 +5810,24 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_SAMPLER_INFO_CONTEXT: { const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; if (sizeof(ur_context_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_SAMPLER_INFO_NORMALIZED_COORDS: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6697,15 +5835,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_SAMPLER_INFO_ADDRESSING_MODE: { - const ur_sampler_addressing_mode_t *tptr = - (const ur_sampler_addressing_mode_t *)ptr; + const ur_sampler_addressing_mode_t *tptr = (const ur_sampler_addressing_mode_t *)ptr; if (sizeof(ur_sampler_addressing_mode_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_sampler_addressing_mode_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_sampler_addressing_mode_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6713,14 +5847,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_SAMPLER_INFO_FILTER_MODE: { - const ur_sampler_filter_mode_t *tptr = - (const ur_sampler_filter_mode_t *)ptr; + const ur_sampler_filter_mode_t *tptr = (const ur_sampler_filter_mode_t *)ptr; if (sizeof(ur_sampler_filter_mode_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_sampler_filter_mode_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_sampler_filter_mode_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -6730,12 +5861,17 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - const struct ur_sampler_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_sampler_desc_t params) { os << "(struct ur_sampler_desc_t){"; os << ".stype = "; @@ -6745,7 +5881,8 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".normalizedCoords = "; @@ -6765,9 +5902,11 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_sampler_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_sampler_native_properties_t params) { os << "(struct ur_sampler_native_properties_t){"; os << ".stype = "; @@ -6777,7 +5916,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -6787,10 +5927,12 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_host_mem_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_host_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_host_mem_flag_t value) { switch (value) { - case UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT: os << "UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT"; break; @@ -6801,13 +5943,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_host_mem_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) == - (uint32_t)UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) { + if ((val & UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) == (uint32_t)UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT) { val ^= (uint32_t)UR_USM_HOST_MEM_FLAG_INITIAL_PLACEMENT; if (!first) { os << " | "; @@ -6825,19 +5969,21 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_device_mem_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_device_mem_flag_t value) { switch (value) { - case UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED: os << "UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED"; break; - case UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT: os << "UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT"; break; - case UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY: os << "UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY"; break; @@ -6848,14 +5994,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_device_mem_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) == - (uint32_t)UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) { + if ((val & UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) == (uint32_t)UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED) { val ^= (uint32_t)UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED; if (!first) { os << " | "; @@ -6865,8 +6012,7 @@ inline void printFlag(std::ostream &os, os << UR_USM_DEVICE_MEM_FLAG_WRITE_COMBINED; } - if ((val & UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) == - (uint32_t)UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) { + if ((val & UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) == (uint32_t)UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT) { val ^= (uint32_t)UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT; if (!first) { os << " | "; @@ -6876,8 +6022,7 @@ inline void printFlag(std::ostream &os, os << UR_USM_DEVICE_MEM_FLAG_INITIAL_PLACEMENT; } - if ((val & UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY) == - (uint32_t)UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY) { + if ((val & UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY) == (uint32_t)UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY) { val ^= (uint32_t)UR_USM_DEVICE_MEM_FLAG_DEVICE_READ_ONLY; if (!first) { os << " | "; @@ -6895,11 +6040,15 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_pool_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_flag_t value) { switch (value) { - case UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK: os << "UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK"; break; @@ -6910,13 +6059,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK) == - (uint32_t)UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK) { + if ((val & UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK) == (uint32_t)UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK) { val ^= (uint32_t)UR_USM_POOL_FLAG_ZERO_INITIALIZE_BLOCK; if (!first) { os << " | "; @@ -6934,22 +6085,24 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_type_t value) { switch (value) { - case UR_USM_TYPE_UNKNOWN: os << "UR_USM_TYPE_UNKNOWN"; break; - case UR_USM_TYPE_HOST: os << "UR_USM_TYPE_HOST"; break; - case UR_USM_TYPE_DEVICE: os << "UR_USM_TYPE_DEVICE"; break; - case UR_USM_TYPE_SHARED: os << "UR_USM_TYPE_SHARED"; break; @@ -6959,26 +6112,24 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_usm_type_t value) { } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_alloc_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_alloc_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_alloc_info_t value) { switch (value) { - case UR_USM_ALLOC_INFO_TYPE: os << "UR_USM_ALLOC_INFO_TYPE"; break; - case UR_USM_ALLOC_INFO_BASE_PTR: os << "UR_USM_ALLOC_INFO_BASE_PTR"; break; - case UR_USM_ALLOC_INFO_SIZE: os << "UR_USM_ALLOC_INFO_SIZE"; break; - case UR_USM_ALLOC_INFO_DEVICE: os << "UR_USM_ALLOC_INFO_DEVICE"; break; - case UR_USM_ALLOC_INFO_POOL: os << "UR_USM_ALLOC_INFO_POOL"; break; @@ -6988,22 +6139,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_alloc_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_usm_alloc_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_alloc_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_USM_ALLOC_INFO_TYPE: { const ur_usm_type_t *tptr = (const ur_usm_type_t *)ptr; if (sizeof(ur_usm_type_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_usm_type_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_usm_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7011,13 +6161,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_USM_ALLOC_INFO_BASE_PTR: { const void *const *tptr = (const void *const *)ptr; if (sizeof(void *) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(void *) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(void *) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7025,13 +6173,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_USM_ALLOC_INFO_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7039,100 +6185,88 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_USM_ALLOC_INFO_DEVICE: { const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; if (sizeof(ur_device_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_USM_ALLOC_INFO_POOL: { const ur_usm_pool_handle_t *tptr = (const ur_usm_pool_handle_t *)ptr; if (sizeof(ur_usm_pool_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_usm_pool_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_usm_pool_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_advice_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_advice_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value) { switch (value) { - case UR_USM_ADVICE_FLAG_DEFAULT: os << "UR_USM_ADVICE_FLAG_DEFAULT"; break; - case UR_USM_ADVICE_FLAG_SET_READ_MOSTLY: os << "UR_USM_ADVICE_FLAG_SET_READ_MOSTLY"; break; - case UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY: os << "UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY"; break; - case UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION: os << "UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION"; break; - case UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION: os << "UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION"; break; - case UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY: os << "UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY"; break; - case UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY: os << "UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY"; break; - case UR_USM_ADVICE_FLAG_BIAS_CACHED: os << "UR_USM_ADVICE_FLAG_BIAS_CACHED"; break; - case UR_USM_ADVICE_FLAG_BIAS_UNCACHED: os << "UR_USM_ADVICE_FLAG_BIAS_UNCACHED"; break; - case UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE: os << "UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE"; break; - case UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE: os << "UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE"; break; - case UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST: os << "UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST"; break; - case UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST: os << "UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST"; break; - case UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST: os << "UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST"; break; - case UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST: os << "UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST"; break; @@ -7143,13 +6277,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_advice_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_USM_ADVICE_FLAG_DEFAULT) == - (uint32_t)UR_USM_ADVICE_FLAG_DEFAULT) { + if ((val & UR_USM_ADVICE_FLAG_DEFAULT) == (uint32_t)UR_USM_ADVICE_FLAG_DEFAULT) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_DEFAULT; if (!first) { os << " | "; @@ -7159,8 +6295,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_DEFAULT; } - if ((val & UR_USM_ADVICE_FLAG_SET_READ_MOSTLY) == - (uint32_t)UR_USM_ADVICE_FLAG_SET_READ_MOSTLY) { + if ((val & UR_USM_ADVICE_FLAG_SET_READ_MOSTLY) == (uint32_t)UR_USM_ADVICE_FLAG_SET_READ_MOSTLY) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_READ_MOSTLY; if (!first) { os << " | "; @@ -7170,8 +6305,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_SET_READ_MOSTLY; } - if ((val & UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY) == - (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY) { + if ((val & UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY; if (!first) { os << " | "; @@ -7181,8 +6315,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY; } - if ((val & UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION) == - (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION) { + if ((val & UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION) == (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION; if (!first) { os << " | "; @@ -7192,8 +6325,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION; } - if ((val & UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION) == - (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION) { + if ((val & UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION; if (!first) { os << " | "; @@ -7203,8 +6335,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION; } - if ((val & UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY) == - (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY) { + if ((val & UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY) == (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY; if (!first) { os << " | "; @@ -7214,8 +6345,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY; } - if ((val & UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY) == - (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY) { + if ((val & UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY; if (!first) { os << " | "; @@ -7225,8 +6355,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY; } - if ((val & UR_USM_ADVICE_FLAG_BIAS_CACHED) == - (uint32_t)UR_USM_ADVICE_FLAG_BIAS_CACHED) { + if ((val & UR_USM_ADVICE_FLAG_BIAS_CACHED) == (uint32_t)UR_USM_ADVICE_FLAG_BIAS_CACHED) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_BIAS_CACHED; if (!first) { os << " | "; @@ -7236,8 +6365,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_BIAS_CACHED; } - if ((val & UR_USM_ADVICE_FLAG_BIAS_UNCACHED) == - (uint32_t)UR_USM_ADVICE_FLAG_BIAS_UNCACHED) { + if ((val & UR_USM_ADVICE_FLAG_BIAS_UNCACHED) == (uint32_t)UR_USM_ADVICE_FLAG_BIAS_UNCACHED) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_BIAS_UNCACHED; if (!first) { os << " | "; @@ -7247,8 +6375,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_BIAS_UNCACHED; } - if ((val & UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE) == - (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE) { + if ((val & UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE) == (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE; if (!first) { os << " | "; @@ -7258,8 +6385,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE; } - if ((val & UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE) == - (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE) { + if ((val & UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE; if (!first) { os << " | "; @@ -7269,8 +6395,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE; } - if ((val & UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST) == - (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST) { + if ((val & UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST) == (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST; if (!first) { os << " | "; @@ -7280,8 +6405,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST; } - if ((val & UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST) == - (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST) { + if ((val & UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST; if (!first) { os << " | "; @@ -7291,8 +6415,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST; } - if ((val & UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST) == - (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST) { + if ((val & UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST) == (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST; if (!first) { os << " | "; @@ -7302,8 +6425,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST; } - if ((val & UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST) == - (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST) { + if ((val & UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST) { val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST; if (!first) { os << " | "; @@ -7321,9 +6443,14 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_desc_t params) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_desc_t params) { os << "(struct ur_usm_desc_t){"; os << ".stype = "; @@ -7333,12 +6460,14 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".hints = "; - printFlag(os, (params.hints)); + details::printFlag(os, + (params.hints)); os << ", "; os << ".align = "; @@ -7348,8 +6477,11 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_host_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_host_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_host_desc_t params) { os << "(struct ur_usm_host_desc_t){"; os << ".stype = "; @@ -7359,18 +6491,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - printFlag(os, (params.flags)); + details::printFlag(os, + (params.flags)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_device_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_device_desc_t params) { os << "(struct ur_usm_device_desc_t){"; os << ".stype = "; @@ -7380,18 +6517,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - printFlag(os, (params.flags)); + details::printFlag(os, + (params.flags)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_pool_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_pool_desc_t params) { os << "(struct ur_usm_pool_desc_t){"; os << ".stype = "; @@ -7401,18 +6543,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - printFlag(os, (params.flags)); + details::printFlag(os, + (params.flags)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_usm_pool_limits_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_limits_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_pool_limits_desc_t params) { os << "(struct ur_usm_pool_limits_desc_t){"; os << ".stype = "; @@ -7422,7 +6569,8 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".maxPoolableSize = "; @@ -7437,14 +6585,15 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_pool_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_info_t value) { switch (value) { - case UR_USM_POOL_INFO_REFERENCE_COUNT: os << "UR_USM_POOL_INFO_REFERENCE_COUNT"; break; - case UR_USM_POOL_INFO_CONTEXT: os << "UR_USM_POOL_INFO_CONTEXT"; break; @@ -7454,22 +6603,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_pool_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_usm_pool_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_pool_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_USM_POOL_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7477,34 +6625,36 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_USM_POOL_INFO_CONTEXT: { const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; if (sizeof(ur_context_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_virtual_mem_granularity_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_granularity_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_granularity_info_t value) { switch (value) { - case UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM: os << "UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM"; break; - case UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED: os << "UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED"; break; @@ -7514,22 +6664,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_granularity_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_granularity_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem_granularity_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7537,13 +6686,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7553,22 +6700,24 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_virtual_mem_access_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_access_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_access_flag_t value) { switch (value) { - case UR_VIRTUAL_MEM_ACCESS_FLAG_NONE: os << "UR_VIRTUAL_MEM_ACCESS_FLAG_NONE"; break; - case UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE: os << "UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE"; break; - case UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY: os << "UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY"; break; @@ -7579,14 +6728,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_access_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_NONE) == - (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_NONE) { + if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_NONE) == (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_NONE) { val ^= (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_NONE; if (!first) { os << " | "; @@ -7596,8 +6746,7 @@ inline void printFlag(std::ostream &os, os << UR_VIRTUAL_MEM_ACCESS_FLAG_NONE; } - if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE) == - (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE) { + if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE) == (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE) { val ^= (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE; if (!first) { os << " | "; @@ -7607,8 +6756,7 @@ inline void printFlag(std::ostream &os, os << UR_VIRTUAL_MEM_ACCESS_FLAG_READ_WRITE; } - if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY) == - (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY) { + if ((val & UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY) == (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY) { val ^= (uint32_t)UR_VIRTUAL_MEM_ACCESS_FLAG_READ_ONLY; if (!first) { os << " | "; @@ -7626,11 +6774,15 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_virtual_mem_info_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_info_t value) { switch (value) { - case UR_VIRTUAL_MEM_INFO_ACCESS_MODE: os << "UR_VIRTUAL_MEM_INFO_ACCESS_MODE"; break; @@ -7640,41 +6792,43 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_virtual_mem_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_virtual_mem_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_VIRTUAL_MEM_INFO_ACCESS_MODE: { - const ur_virtual_mem_access_flags_t *tptr = - (const ur_virtual_mem_access_flags_t *)ptr; + const ur_virtual_mem_access_flags_t *tptr = (const ur_virtual_mem_access_flags_t *)ptr; if (sizeof(ur_virtual_mem_access_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_virtual_mem_access_flags_t) - << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_virtual_mem_access_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_physical_mem_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_physical_mem_flag_t value) { switch (value) { - case UR_PHYSICAL_MEM_FLAG_TBD: os << "UR_PHYSICAL_MEM_FLAG_TBD"; break; @@ -7685,13 +6839,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_physical_mem_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_PHYSICAL_MEM_FLAG_TBD) == - (uint32_t)UR_PHYSICAL_MEM_FLAG_TBD) { + if ((val & UR_PHYSICAL_MEM_FLAG_TBD) == (uint32_t)UR_PHYSICAL_MEM_FLAG_TBD) { val ^= (uint32_t)UR_PHYSICAL_MEM_FLAG_TBD; if (!first) { os << " | "; @@ -7709,9 +6865,14 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { os << "(struct ur_physical_mem_properties_t){"; os << ".stype = "; @@ -7721,32 +6882,33 @@ operator<<(std::ostream &os, const struct ur_physical_mem_properties_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - printFlag(os, (params.flags)); + details::printFlag(os, + (params.flags)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_metadata_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_metadata_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_program_metadata_type_t value) { switch (value) { - case UR_PROGRAM_METADATA_TYPE_UINT32: os << "UR_PROGRAM_METADATA_TYPE_UINT32"; break; - case UR_PROGRAM_METADATA_TYPE_UINT64: os << "UR_PROGRAM_METADATA_TYPE_UINT64"; break; - case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: os << "UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY"; break; - case UR_PROGRAM_METADATA_TYPE_STRING: os << "UR_PROGRAM_METADATA_TYPE_STRING"; break; @@ -7756,10 +6918,14 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { -inline void printUnion(std::ostream &os, - const union ur_program_metadata_value_t params, - const enum ur_program_metadata_type_t tag) { +/////////////////////////////////////////////////////////////////////////////// +// @brief Print ur_program_metadata_value_t union +inline ur_result_t printUnion( + std::ostream &os, + const union ur_program_metadata_value_t params, + const enum ur_program_metadata_type_t tag) { os << "(union ur_program_metadata_value_t){"; switch (tag) { @@ -7781,29 +6947,37 @@ inline void printUnion(std::ostream &os, os << ".pString = "; - printPtr(os, (params.pString)); + details::printPtr(os, + (params.pString)); break; case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: os << ".pData = "; - printPtr(os, (params.pData)); + details::printPtr(os, + (params.pData)); break; default: os << ""; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } os << "}"; -} -inline std::ostream &operator<<(std::ostream &os, - const struct ur_program_metadata_t params) { + return UR_RESULT_SUCCESS; +} +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_metadata_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_program_metadata_t params) { os << "(struct ur_program_metadata_t){"; os << ".pName = "; - printPtr(os, (params.pName)); + details::printPtr(os, + (params.pName)); os << ", "; os << ".type = "; @@ -7817,13 +6991,16 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".value = "; - printUnion(os, (params.value), params.type); + details::printUnion(os, (params.value), params.type); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_program_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_program_properties_t params) { os << "(struct ur_program_properties_t){"; os << ".stype = "; @@ -7833,7 +7010,8 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".count = "; @@ -7854,42 +7032,36 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_program_info_t value) { switch (value) { - case UR_PROGRAM_INFO_REFERENCE_COUNT: os << "UR_PROGRAM_INFO_REFERENCE_COUNT"; break; - case UR_PROGRAM_INFO_CONTEXT: os << "UR_PROGRAM_INFO_CONTEXT"; break; - case UR_PROGRAM_INFO_NUM_DEVICES: os << "UR_PROGRAM_INFO_NUM_DEVICES"; break; - case UR_PROGRAM_INFO_DEVICES: os << "UR_PROGRAM_INFO_DEVICES"; break; - case UR_PROGRAM_INFO_SOURCE: os << "UR_PROGRAM_INFO_SOURCE"; break; - case UR_PROGRAM_INFO_BINARY_SIZES: os << "UR_PROGRAM_INFO_BINARY_SIZES"; break; - case UR_PROGRAM_INFO_BINARIES: os << "UR_PROGRAM_INFO_BINARIES"; break; - case UR_PROGRAM_INFO_NUM_KERNELS: os << "UR_PROGRAM_INFO_NUM_KERNELS"; break; - case UR_PROGRAM_INFO_KERNEL_NAMES: os << "UR_PROGRAM_INFO_KERNEL_NAMES"; break; @@ -7899,22 +7071,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_program_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_PROGRAM_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7922,27 +7093,24 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROGRAM_INFO_CONTEXT: { const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; if (sizeof(ur_context_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_PROGRAM_INFO_NUM_DEVICES: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -7950,7 +7118,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROGRAM_INFO_DEVICES: { const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; @@ -7961,17 +7128,16 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ", "; } - printPtr(os, tptr[i]); + details::printPtr(os, + tptr[i]); } os << "}"; } break; - case UR_PROGRAM_INFO_SOURCE: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PROGRAM_INFO_BINARY_SIZES: { const size_t *tptr = (const size_t *)ptr; @@ -7986,19 +7152,16 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_PROGRAM_INFO_BINARIES: { const unsigned char *tptr = (const unsigned char *)ptr; printPtr(os, tptr); } break; - case UR_PROGRAM_INFO_NUM_KERNELS: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8006,7 +7169,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROGRAM_INFO_KERNEL_NAMES: { const char *tptr = (const char *)ptr; @@ -8014,26 +7176,27 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_build_status_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_status_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_program_build_status_t value) { switch (value) { - case UR_PROGRAM_BUILD_STATUS_NONE: os << "UR_PROGRAM_BUILD_STATUS_NONE"; break; - case UR_PROGRAM_BUILD_STATUS_ERROR: os << "UR_PROGRAM_BUILD_STATUS_ERROR"; break; - case UR_PROGRAM_BUILD_STATUS_SUCCESS: os << "UR_PROGRAM_BUILD_STATUS_SUCCESS"; break; - case UR_PROGRAM_BUILD_STATUS_IN_PROGRESS: os << "UR_PROGRAM_BUILD_STATUS_IN_PROGRESS"; break; @@ -8043,22 +7206,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_binary_type_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_binary_type_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_program_binary_type_t value) { switch (value) { - case UR_PROGRAM_BINARY_TYPE_NONE: os << "UR_PROGRAM_BINARY_TYPE_NONE"; break; - case UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT: os << "UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT"; break; - case UR_PROGRAM_BINARY_TYPE_LIBRARY: os << "UR_PROGRAM_BINARY_TYPE_LIBRARY"; break; - case UR_PROGRAM_BINARY_TYPE_EXECUTABLE: os << "UR_PROGRAM_BINARY_TYPE_EXECUTABLE"; break; @@ -8068,22 +7230,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_program_build_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_program_build_info_t value) { switch (value) { - case UR_PROGRAM_BUILD_INFO_STATUS: os << "UR_PROGRAM_BUILD_INFO_STATUS"; break; - case UR_PROGRAM_BUILD_INFO_OPTIONS: os << "UR_PROGRAM_BUILD_INFO_OPTIONS"; break; - case UR_PROGRAM_BUILD_INFO_LOG: os << "UR_PROGRAM_BUILD_INFO_LOG"; break; - case UR_PROGRAM_BUILD_INFO_BINARY_TYPE: os << "UR_PROGRAM_BUILD_INFO_BINARY_TYPE"; break; @@ -8093,23 +7254,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_program_build_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_program_build_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_build_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_PROGRAM_BUILD_INFO_STATUS: { - const ur_program_build_status_t *tptr = - (const ur_program_build_status_t *)ptr; + const ur_program_build_status_t *tptr = (const ur_program_build_status_t *)ptr; if (sizeof(ur_program_build_status_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_program_build_status_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_program_build_status_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8117,26 +7276,21 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROGRAM_BUILD_INFO_OPTIONS: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PROGRAM_BUILD_INFO_LOG: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_PROGRAM_BUILD_INFO_BINARY_TYPE: { - const ur_program_binary_type_t *tptr = - (const ur_program_binary_type_t *)ptr; + const ur_program_binary_type_t *tptr = (const ur_program_binary_type_t *)ptr; if (sizeof(ur_program_binary_type_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_program_binary_type_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_program_binary_type_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8146,13 +7300,17 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_specialization_constant_info_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_specialization_constant_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_specialization_constant_info_t params) { os << "(struct ur_specialization_constant_info_t){"; os << ".id = "; @@ -8167,14 +7325,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pValue = "; - printPtr(os, (params.pValue)); + details::printPtr(os, + (params.pValue)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_program_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_program_native_properties_t params) { os << "(struct ur_program_native_properties_t){"; os << ".stype = "; @@ -8184,7 +7345,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8194,9 +7356,11 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_value_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_value_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_value_properties_t params) { os << "(struct ur_kernel_arg_value_properties_t){"; os << ".stype = "; @@ -8206,14 +7370,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_local_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_local_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_local_properties_t params) { os << "(struct ur_kernel_arg_local_properties_t){"; os << ".stype = "; @@ -8223,38 +7390,36 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_kernel_info_t value) { switch (value) { - case UR_KERNEL_INFO_FUNCTION_NAME: os << "UR_KERNEL_INFO_FUNCTION_NAME"; break; - case UR_KERNEL_INFO_NUM_ARGS: os << "UR_KERNEL_INFO_NUM_ARGS"; break; - case UR_KERNEL_INFO_REFERENCE_COUNT: os << "UR_KERNEL_INFO_REFERENCE_COUNT"; break; - case UR_KERNEL_INFO_CONTEXT: os << "UR_KERNEL_INFO_CONTEXT"; break; - case UR_KERNEL_INFO_PROGRAM: os << "UR_KERNEL_INFO_PROGRAM"; break; - case UR_KERNEL_INFO_ATTRIBUTES: os << "UR_KERNEL_INFO_ATTRIBUTES"; break; - case UR_KERNEL_INFO_NUM_REGS: os << "UR_KERNEL_INFO_NUM_REGS"; break; @@ -8264,28 +7429,26 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_kernel_info_t value) { } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_KERNEL_INFO_FUNCTION_NAME: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_KERNEL_INFO_NUM_ARGS: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8293,13 +7456,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8307,47 +7468,42 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_INFO_CONTEXT: { const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; if (sizeof(ur_context_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_KERNEL_INFO_PROGRAM: { const ur_program_handle_t *tptr = (const ur_program_handle_t *)ptr; if (sizeof(ur_program_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_program_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_program_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_KERNEL_INFO_ATTRIBUTES: { const char *tptr = (const char *)ptr; printPtr(os, tptr); } break; - case UR_KERNEL_INFO_NUM_REGS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8357,34 +7513,33 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_group_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_group_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_kernel_group_info_t value) { switch (value) { - case UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE: os << "UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE"; break; - case UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE: os << "UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE"; break; - case UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE: os << "UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE"; break; - case UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE: os << "UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE"; break; - case UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: os << "UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE"; break; - case UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: os << "UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE"; break; @@ -8394,16 +7549,16 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_group_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_group_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_group_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_KERNEL_GROUP_INFO_GLOBAL_WORK_SIZE: { const size_t *tptr = (const size_t *)ptr; @@ -8418,13 +7573,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_KERNEL_GROUP_INFO_WORK_GROUP_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8432,7 +7585,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_GROUP_INFO_COMPILE_WORK_GROUP_SIZE: { const size_t *tptr = (const size_t *)ptr; @@ -8447,13 +7599,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_KERNEL_GROUP_INFO_LOCAL_MEM_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8461,13 +7611,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_GROUP_INFO_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8475,13 +7623,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_GROUP_INFO_PRIVATE_MEM_SIZE: { const size_t *tptr = (const size_t *)ptr; if (sizeof(size_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(size_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(size_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8491,26 +7637,27 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_sub_group_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_sub_group_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_kernel_sub_group_info_t value) { switch (value) { - case UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE: os << "UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE"; break; - case UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS: os << "UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS"; break; - case UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS: os << "UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS"; break; - case UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL: os << "UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL"; break; @@ -8520,22 +7667,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_sub_group_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_sub_group_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_sub_group_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_KERNEL_SUB_GROUP_INFO_MAX_SUB_GROUP_SIZE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8543,13 +7689,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_SUB_GROUP_INFO_MAX_NUM_SUB_GROUPS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8557,13 +7701,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_SUB_GROUP_INFO_COMPILE_NUM_SUB_GROUPS: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8571,13 +7713,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_SUB_GROUP_INFO_SUB_GROUP_SIZE_INTEL: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8587,22 +7727,24 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_cache_config_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_cache_config_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_kernel_cache_config_t value) { switch (value) { - case UR_KERNEL_CACHE_CONFIG_DEFAULT: os << "UR_KERNEL_CACHE_CONFIG_DEFAULT"; break; - case UR_KERNEL_CACHE_CONFIG_LARGE_SLM: os << "UR_KERNEL_CACHE_CONFIG_LARGE_SLM"; break; - case UR_KERNEL_CACHE_CONFIG_LARGE_DATA: os << "UR_KERNEL_CACHE_CONFIG_LARGE_DATA"; break; @@ -8612,18 +7754,18 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_kernel_exec_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_exec_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_kernel_exec_info_t value) { switch (value) { - case UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS: os << "UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS"; break; - case UR_KERNEL_EXEC_INFO_USM_PTRS: os << "UR_KERNEL_EXEC_INFO_USM_PTRS"; break; - case UR_KERNEL_EXEC_INFO_CACHE_CONFIG: os << "UR_KERNEL_EXEC_INFO_CACHE_CONFIG"; break; @@ -8633,22 +7775,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_kernel_exec_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_kernel_exec_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_exec_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_KERNEL_EXEC_INFO_USM_INDIRECT_ACCESS: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8656,7 +7797,6 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_KERNEL_EXEC_INFO_USM_PTRS: { const void *const *tptr = (const void *const *)ptr; @@ -8671,14 +7811,11 @@ inline void printTagged(std::ostream &os, const void *ptr, } os << "}"; } break; - case UR_KERNEL_EXEC_INFO_CACHE_CONFIG: { - const ur_kernel_cache_config_t *tptr = - (const ur_kernel_cache_config_t *)ptr; + const ur_kernel_cache_config_t *tptr = (const ur_kernel_cache_config_t *)ptr; if (sizeof(ur_kernel_cache_config_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_kernel_cache_config_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_kernel_cache_config_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8688,13 +7825,17 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_pointer_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_pointer_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_pointer_properties_t params) { os << "(struct ur_kernel_arg_pointer_properties_t){"; os << ".stype = "; @@ -8704,14 +7845,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_exec_info_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_exec_info_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_exec_info_properties_t params) { os << "(struct ur_kernel_exec_info_properties_t){"; os << ".stype = "; @@ -8721,14 +7865,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_sampler_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_sampler_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_sampler_properties_t params) { os << "(struct ur_kernel_arg_sampler_properties_t){"; os << ".stype = "; @@ -8738,14 +7885,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_arg_mem_obj_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_arg_mem_obj_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_mem_obj_properties_t params) { os << "(struct ur_kernel_arg_mem_obj_properties_t){"; os << ".stype = "; @@ -8755,19 +7905,23 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".memoryAccess = "; - printFlag(os, (params.memoryAccess)); + details::printFlag(os, + (params.memoryAccess)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_kernel_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_native_properties_t params) { os << "(struct ur_kernel_native_properties_t){"; os << ".stype = "; @@ -8777,7 +7931,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8787,33 +7942,30 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_queue_info_t value) { switch (value) { - case UR_QUEUE_INFO_CONTEXT: os << "UR_QUEUE_INFO_CONTEXT"; break; - case UR_QUEUE_INFO_DEVICE: os << "UR_QUEUE_INFO_DEVICE"; break; - case UR_QUEUE_INFO_DEVICE_DEFAULT: os << "UR_QUEUE_INFO_DEVICE_DEFAULT"; break; - case UR_QUEUE_INFO_FLAGS: os << "UR_QUEUE_INFO_FLAGS"; break; - case UR_QUEUE_INFO_REFERENCE_COUNT: os << "UR_QUEUE_INFO_REFERENCE_COUNT"; break; - case UR_QUEUE_INFO_SIZE: os << "UR_QUEUE_INFO_SIZE"; break; - case UR_QUEUE_INFO_EMPTY: os << "UR_QUEUE_INFO_EMPTY"; break; @@ -8823,78 +7975,73 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_queue_info_t value) { } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_queue_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_QUEUE_INFO_CONTEXT: { const ur_queue_handle_t *tptr = (const ur_queue_handle_t *)ptr; if (sizeof(ur_queue_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_QUEUE_INFO_DEVICE: { const ur_device_handle_t *tptr = (const ur_device_handle_t *)ptr; if (sizeof(ur_device_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_QUEUE_INFO_DEVICE_DEFAULT: { const ur_queue_handle_t *tptr = (const ur_queue_handle_t *)ptr; if (sizeof(ur_queue_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_QUEUE_INFO_FLAGS: { const ur_queue_flags_t *tptr = (const ur_queue_flags_t *)ptr; if (sizeof(ur_queue_flags_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printFlag(os, *tptr); + details::printFlag(os, + *tptr); os << ")"; } break; - case UR_QUEUE_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8902,13 +8049,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_QUEUE_INFO_SIZE: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8916,13 +8061,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_QUEUE_INFO_EMPTY: { const ur_bool_t *tptr = (const ur_bool_t *)ptr; if (sizeof(ur_bool_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_bool_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_bool_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -8932,53 +8075,48 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_queue_flag_t value) { switch (value) { - case UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE: os << "UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE"; break; - case UR_QUEUE_FLAG_PROFILING_ENABLE: os << "UR_QUEUE_FLAG_PROFILING_ENABLE"; break; - case UR_QUEUE_FLAG_ON_DEVICE: os << "UR_QUEUE_FLAG_ON_DEVICE"; break; - case UR_QUEUE_FLAG_ON_DEVICE_DEFAULT: os << "UR_QUEUE_FLAG_ON_DEVICE_DEFAULT"; break; - case UR_QUEUE_FLAG_DISCARD_EVENTS: os << "UR_QUEUE_FLAG_DISCARD_EVENTS"; break; - case UR_QUEUE_FLAG_PRIORITY_LOW: os << "UR_QUEUE_FLAG_PRIORITY_LOW"; break; - case UR_QUEUE_FLAG_PRIORITY_HIGH: os << "UR_QUEUE_FLAG_PRIORITY_HIGH"; break; - case UR_QUEUE_FLAG_SUBMISSION_BATCHED: os << "UR_QUEUE_FLAG_SUBMISSION_BATCHED"; break; - case UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE: os << "UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE"; break; - case UR_QUEUE_FLAG_USE_DEFAULT_STREAM: os << "UR_QUEUE_FLAG_USE_DEFAULT_STREAM"; break; - case UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM: os << "UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM"; break; @@ -8989,13 +8127,15 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_queue_flag_t value) { return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_queue_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) == - (uint32_t)UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) { + if ((val & UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) == (uint32_t)UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE) { val ^= (uint32_t)UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE; if (!first) { os << " | "; @@ -9005,8 +8145,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE; } - if ((val & UR_QUEUE_FLAG_PROFILING_ENABLE) == - (uint32_t)UR_QUEUE_FLAG_PROFILING_ENABLE) { + if ((val & UR_QUEUE_FLAG_PROFILING_ENABLE) == (uint32_t)UR_QUEUE_FLAG_PROFILING_ENABLE) { val ^= (uint32_t)UR_QUEUE_FLAG_PROFILING_ENABLE; if (!first) { os << " | "; @@ -9026,8 +8165,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_ON_DEVICE; } - if ((val & UR_QUEUE_FLAG_ON_DEVICE_DEFAULT) == - (uint32_t)UR_QUEUE_FLAG_ON_DEVICE_DEFAULT) { + if ((val & UR_QUEUE_FLAG_ON_DEVICE_DEFAULT) == (uint32_t)UR_QUEUE_FLAG_ON_DEVICE_DEFAULT) { val ^= (uint32_t)UR_QUEUE_FLAG_ON_DEVICE_DEFAULT; if (!first) { os << " | "; @@ -9037,8 +8175,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_ON_DEVICE_DEFAULT; } - if ((val & UR_QUEUE_FLAG_DISCARD_EVENTS) == - (uint32_t)UR_QUEUE_FLAG_DISCARD_EVENTS) { + if ((val & UR_QUEUE_FLAG_DISCARD_EVENTS) == (uint32_t)UR_QUEUE_FLAG_DISCARD_EVENTS) { val ^= (uint32_t)UR_QUEUE_FLAG_DISCARD_EVENTS; if (!first) { os << " | "; @@ -9048,8 +8185,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_DISCARD_EVENTS; } - if ((val & UR_QUEUE_FLAG_PRIORITY_LOW) == - (uint32_t)UR_QUEUE_FLAG_PRIORITY_LOW) { + if ((val & UR_QUEUE_FLAG_PRIORITY_LOW) == (uint32_t)UR_QUEUE_FLAG_PRIORITY_LOW) { val ^= (uint32_t)UR_QUEUE_FLAG_PRIORITY_LOW; if (!first) { os << " | "; @@ -9059,8 +8195,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_PRIORITY_LOW; } - if ((val & UR_QUEUE_FLAG_PRIORITY_HIGH) == - (uint32_t)UR_QUEUE_FLAG_PRIORITY_HIGH) { + if ((val & UR_QUEUE_FLAG_PRIORITY_HIGH) == (uint32_t)UR_QUEUE_FLAG_PRIORITY_HIGH) { val ^= (uint32_t)UR_QUEUE_FLAG_PRIORITY_HIGH; if (!first) { os << " | "; @@ -9070,8 +8205,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_PRIORITY_HIGH; } - if ((val & UR_QUEUE_FLAG_SUBMISSION_BATCHED) == - (uint32_t)UR_QUEUE_FLAG_SUBMISSION_BATCHED) { + if ((val & UR_QUEUE_FLAG_SUBMISSION_BATCHED) == (uint32_t)UR_QUEUE_FLAG_SUBMISSION_BATCHED) { val ^= (uint32_t)UR_QUEUE_FLAG_SUBMISSION_BATCHED; if (!first) { os << " | "; @@ -9081,8 +8215,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_SUBMISSION_BATCHED; } - if ((val & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) == - (uint32_t)UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) { + if ((val & UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) == (uint32_t)UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE) { val ^= (uint32_t)UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE; if (!first) { os << " | "; @@ -9092,8 +8225,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_SUBMISSION_IMMEDIATE; } - if ((val & UR_QUEUE_FLAG_USE_DEFAULT_STREAM) == - (uint32_t)UR_QUEUE_FLAG_USE_DEFAULT_STREAM) { + if ((val & UR_QUEUE_FLAG_USE_DEFAULT_STREAM) == (uint32_t)UR_QUEUE_FLAG_USE_DEFAULT_STREAM) { val ^= (uint32_t)UR_QUEUE_FLAG_USE_DEFAULT_STREAM; if (!first) { os << " | "; @@ -9103,8 +8235,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_QUEUE_FLAG_USE_DEFAULT_STREAM; } - if ((val & UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) == - (uint32_t)UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) { + if ((val & UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) == (uint32_t)UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM) { val ^= (uint32_t)UR_QUEUE_FLAG_SYNC_WITH_DEFAULT_STREAM; if (!first) { os << " | "; @@ -9122,9 +8253,14 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_properties_t params) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_properties_t params) { os << "(struct ur_queue_properties_t){"; os << ".stype = "; @@ -9134,18 +8270,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - printFlag(os, (params.flags)); + details::printFlag(os, + (params.flags)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_index_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { os << "(struct ur_queue_index_properties_t){"; os << ".stype = "; @@ -9155,7 +8296,8 @@ operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".computeIndex = "; @@ -9165,8 +8307,11 @@ operator<<(std::ostream &os, const struct ur_queue_index_properties_t params) { os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_queue_native_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_native_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_native_desc_t params) { os << "(struct ur_queue_native_desc_t){"; os << ".stype = "; @@ -9176,18 +8321,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".pNativeData = "; - printPtr(os, (params.pNativeData)); + details::printPtr(os, + (params.pNativeData)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { os << "(struct ur_queue_native_properties_t){"; os << ".stype = "; @@ -9197,7 +8347,8 @@ operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -9207,117 +8358,93 @@ operator<<(std::ostream &os, const struct ur_queue_native_properties_t params) { os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_command_t value) { switch (value) { - case UR_COMMAND_KERNEL_LAUNCH: os << "UR_COMMAND_KERNEL_LAUNCH"; break; - case UR_COMMAND_EVENTS_WAIT: os << "UR_COMMAND_EVENTS_WAIT"; break; - case UR_COMMAND_EVENTS_WAIT_WITH_BARRIER: os << "UR_COMMAND_EVENTS_WAIT_WITH_BARRIER"; break; - case UR_COMMAND_MEM_BUFFER_READ: os << "UR_COMMAND_MEM_BUFFER_READ"; break; - case UR_COMMAND_MEM_BUFFER_WRITE: os << "UR_COMMAND_MEM_BUFFER_WRITE"; break; - case UR_COMMAND_MEM_BUFFER_READ_RECT: os << "UR_COMMAND_MEM_BUFFER_READ_RECT"; break; - case UR_COMMAND_MEM_BUFFER_WRITE_RECT: os << "UR_COMMAND_MEM_BUFFER_WRITE_RECT"; break; - case UR_COMMAND_MEM_BUFFER_COPY: os << "UR_COMMAND_MEM_BUFFER_COPY"; break; - case UR_COMMAND_MEM_BUFFER_COPY_RECT: os << "UR_COMMAND_MEM_BUFFER_COPY_RECT"; break; - case UR_COMMAND_MEM_BUFFER_FILL: os << "UR_COMMAND_MEM_BUFFER_FILL"; break; - case UR_COMMAND_MEM_IMAGE_READ: os << "UR_COMMAND_MEM_IMAGE_READ"; break; - case UR_COMMAND_MEM_IMAGE_WRITE: os << "UR_COMMAND_MEM_IMAGE_WRITE"; break; - case UR_COMMAND_MEM_IMAGE_COPY: os << "UR_COMMAND_MEM_IMAGE_COPY"; break; - case UR_COMMAND_MEM_BUFFER_MAP: os << "UR_COMMAND_MEM_BUFFER_MAP"; break; - case UR_COMMAND_MEM_UNMAP: os << "UR_COMMAND_MEM_UNMAP"; break; - case UR_COMMAND_USM_FILL: os << "UR_COMMAND_USM_FILL"; break; - case UR_COMMAND_USM_MEMCPY: os << "UR_COMMAND_USM_MEMCPY"; break; - case UR_COMMAND_USM_PREFETCH: os << "UR_COMMAND_USM_PREFETCH"; break; - case UR_COMMAND_USM_ADVISE: os << "UR_COMMAND_USM_ADVISE"; break; - case UR_COMMAND_USM_FILL_2D: os << "UR_COMMAND_USM_FILL_2D"; break; - case UR_COMMAND_USM_MEMCPY_2D: os << "UR_COMMAND_USM_MEMCPY_2D"; break; - case UR_COMMAND_DEVICE_GLOBAL_VARIABLE_WRITE: os << "UR_COMMAND_DEVICE_GLOBAL_VARIABLE_WRITE"; break; - case UR_COMMAND_DEVICE_GLOBAL_VARIABLE_READ: os << "UR_COMMAND_DEVICE_GLOBAL_VARIABLE_READ"; break; - case UR_COMMAND_READ_HOST_PIPE: os << "UR_COMMAND_READ_HOST_PIPE"; break; - case UR_COMMAND_WRITE_HOST_PIPE: os << "UR_COMMAND_WRITE_HOST_PIPE"; break; - case UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP: os << "UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP"; break; - case UR_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP: os << "UR_COMMAND_INTEROP_SEMAPHORE_WAIT_EXP"; break; - case UR_COMMAND_INTEROP_SEMAPHORE_SIGNAL_EXP: os << "UR_COMMAND_INTEROP_SEMAPHORE_SIGNAL_EXP"; break; @@ -9327,22 +8454,21 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_command_t value) { } return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_event_status_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_status_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_event_status_t value) { switch (value) { - case UR_EVENT_STATUS_COMPLETE: os << "UR_EVENT_STATUS_COMPLETE"; break; - case UR_EVENT_STATUS_RUNNING: os << "UR_EVENT_STATUS_RUNNING"; break; - case UR_EVENT_STATUS_SUBMITTED: os << "UR_EVENT_STATUS_SUBMITTED"; break; - case UR_EVENT_STATUS_QUEUED: os << "UR_EVENT_STATUS_QUEUED"; break; @@ -9352,25 +8478,24 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_event_info_t value) { switch (value) { - case UR_EVENT_INFO_COMMAND_QUEUE: os << "UR_EVENT_INFO_COMMAND_QUEUE"; break; - case UR_EVENT_INFO_CONTEXT: os << "UR_EVENT_INFO_CONTEXT"; break; - case UR_EVENT_INFO_COMMAND_TYPE: os << "UR_EVENT_INFO_COMMAND_TYPE"; break; - case UR_EVENT_INFO_COMMAND_EXECUTION_STATUS: os << "UR_EVENT_INFO_COMMAND_EXECUTION_STATUS"; break; - case UR_EVENT_INFO_REFERENCE_COUNT: os << "UR_EVENT_INFO_REFERENCE_COUNT"; break; @@ -9380,50 +8505,47 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_event_info_t value) { } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_event_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_event_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_event_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_EVENT_INFO_COMMAND_QUEUE: { const ur_queue_handle_t *tptr = (const ur_queue_handle_t *)ptr; if (sizeof(ur_queue_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_EVENT_INFO_CONTEXT: { const ur_context_handle_t *tptr = (const ur_context_handle_t *)ptr; if (sizeof(ur_context_handle_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; - printPtr(os, *tptr); + details::printPtr(os, + *tptr); os << ")"; } break; - case UR_EVENT_INFO_COMMAND_TYPE: { const ur_command_t *tptr = (const ur_command_t *)ptr; if (sizeof(ur_command_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_command_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_command_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9431,13 +8553,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_EVENT_INFO_COMMAND_EXECUTION_STATUS: { const ur_event_status_t *tptr = (const ur_event_status_t *)ptr; if (sizeof(ur_event_status_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(ur_event_status_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(ur_event_status_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9445,13 +8565,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_EVENT_INFO_REFERENCE_COUNT: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9461,30 +8579,30 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream &operator<<(std::ostream &os, - enum ur_profiling_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_profiling_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_profiling_info_t value) { switch (value) { - case UR_PROFILING_INFO_COMMAND_QUEUED: os << "UR_PROFILING_INFO_COMMAND_QUEUED"; break; - case UR_PROFILING_INFO_COMMAND_SUBMIT: os << "UR_PROFILING_INFO_COMMAND_SUBMIT"; break; - case UR_PROFILING_INFO_COMMAND_START: os << "UR_PROFILING_INFO_COMMAND_START"; break; - case UR_PROFILING_INFO_COMMAND_END: os << "UR_PROFILING_INFO_COMMAND_END"; break; - case UR_PROFILING_INFO_COMMAND_COMPLETE: os << "UR_PROFILING_INFO_COMMAND_COMPLETE"; break; @@ -9494,22 +8612,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_profiling_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_profiling_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_profiling_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_PROFILING_INFO_COMMAND_QUEUED: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9517,13 +8634,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROFILING_INFO_COMMAND_SUBMIT: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9531,13 +8646,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROFILING_INFO_COMMAND_START: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9545,13 +8658,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROFILING_INFO_COMMAND_END: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9559,13 +8670,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_PROFILING_INFO_COMMAND_COMPLETE: { const uint64_t *tptr = (const uint64_t *)ptr; if (sizeof(uint64_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint64_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -9575,12 +8684,17 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream & -operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_native_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << "(struct ur_event_native_properties_t){"; os << ".stype = "; @@ -9590,7 +8704,8 @@ operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -9600,22 +8715,21 @@ operator<<(std::ostream &os, const struct ur_event_native_properties_t params) { os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_execution_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_execution_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_execution_info_t value) { switch (value) { - case UR_EXECUTION_INFO_COMPLETE: os << "UR_EXECUTION_INFO_COMPLETE"; break; - case UR_EXECUTION_INFO_RUNNING: os << "UR_EXECUTION_INFO_RUNNING"; break; - case UR_EXECUTION_INFO_SUBMITTED: os << "UR_EXECUTION_INFO_SUBMITTED"; break; - case UR_EXECUTION_INFO_QUEUED: os << "UR_EXECUTION_INFO_QUEUED"; break; @@ -9625,17 +8739,18 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } -inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_map_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_map_flag_t value) { switch (value) { - case UR_MAP_FLAG_READ: os << "UR_MAP_FLAG_READ"; break; - case UR_MAP_FLAG_WRITE: os << "UR_MAP_FLAG_WRITE"; break; - case UR_MAP_FLAG_WRITE_INVALIDATE_REGION: os << "UR_MAP_FLAG_WRITE_INVALIDATE_REGION"; break; @@ -9646,8 +8761,11 @@ inline std::ostream &operator<<(std::ostream &os, enum ur_map_flag_t value) { return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_map_flag_t flag template <> -inline void printFlag(std::ostream &os, uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; @@ -9671,8 +8789,7 @@ inline void printFlag(std::ostream &os, uint32_t flag) { os << UR_MAP_FLAG_WRITE; } - if ((val & UR_MAP_FLAG_WRITE_INVALIDATE_REGION) == - (uint32_t)UR_MAP_FLAG_WRITE_INVALIDATE_REGION) { + if ((val & UR_MAP_FLAG_WRITE_INVALIDATE_REGION) == (uint32_t)UR_MAP_FLAG_WRITE_INVALIDATE_REGION) { val ^= (uint32_t)UR_MAP_FLAG_WRITE_INVALIDATE_REGION; if (!first) { os << " | "; @@ -9690,11 +8807,15 @@ inline void printFlag(std::ostream &os, uint32_t flag) { } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_usm_migration_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_migration_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_usm_migration_flag_t value) { switch (value) { - case UR_USM_MIGRATION_FLAG_DEFAULT: os << "UR_USM_MIGRATION_FLAG_DEFAULT"; break; @@ -9705,14 +8826,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_usm_migration_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_USM_MIGRATION_FLAG_DEFAULT) == - (uint32_t)UR_USM_MIGRATION_FLAG_DEFAULT) { + if ((val & UR_USM_MIGRATION_FLAG_DEFAULT) == (uint32_t)UR_USM_MIGRATION_FLAG_DEFAULT) { val ^= (uint32_t)UR_USM_MIGRATION_FLAG_DEFAULT; if (!first) { os << " | "; @@ -9730,19 +8852,21 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_exp_image_copy_flag_t value) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_image_copy_flag_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_exp_image_copy_flag_t value) { switch (value) { - case UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE: os << "UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE"; break; - case UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST: os << "UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST"; break; - case UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE: os << "UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE"; break; @@ -9753,14 +8877,15 @@ inline std::ostream &operator<<(std::ostream &os, return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_image_copy_flag_t flag template <> -inline void printFlag(std::ostream &os, - uint32_t flag) { +inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { uint32_t val = flag; bool first = true; - if ((val & UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) == - (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) { + if ((val & UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) == (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE) { val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE; if (!first) { os << " | "; @@ -9770,8 +8895,7 @@ inline void printFlag(std::ostream &os, os << UR_EXP_IMAGE_COPY_FLAG_HOST_TO_DEVICE; } - if ((val & UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) == - (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) { + if ((val & UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) == (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST) { val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST; if (!first) { os << " | "; @@ -9781,8 +8905,7 @@ inline void printFlag(std::ostream &os, os << UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_HOST; } - if ((val & UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) == - (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) { + if ((val & UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) == (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE) { val ^= (uint32_t)UR_EXP_IMAGE_COPY_FLAG_DEVICE_TO_DEVICE; if (!first) { os << " | "; @@ -9800,9 +8923,14 @@ inline void printFlag(std::ostream &os, } else if (first) { os << "0"; } + return UR_RESULT_SUCCESS; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_exp_file_descriptor_t params) { +} // namespace details +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_file_descriptor_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_file_descriptor_t params) { os << "(struct ur_exp_file_descriptor_t){"; os << ".stype = "; @@ -9812,7 +8940,8 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".fd = "; @@ -9822,8 +8951,11 @@ inline std::ostream &operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_exp_win32_handle_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_win32_handle_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_win32_handle_t params) { os << "(struct ur_exp_win32_handle_t){"; os << ".stype = "; @@ -9833,19 +8965,23 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".handle = "; - printPtr(os, (params.handle)); + details::printPtr(os, + (params.handle)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_exp_sampler_mip_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_sampler_mip_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_sampler_mip_properties_t params) { os << "(struct ur_exp_sampler_mip_properties_t){"; os << ".stype = "; @@ -9855,7 +8991,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".minMipmapLevelClamp = "; @@ -9880,8 +9017,11 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_sampler_addr_modes_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { os << "(struct ur_exp_sampler_addr_modes_t){"; os << ".stype = "; @@ -9891,7 +9031,8 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".addrModes = {"; @@ -9907,8 +9048,11 @@ operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) { os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - const struct ur_exp_interop_mem_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_interop_mem_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_mem_desc_t params) { os << "(struct ur_exp_interop_mem_desc_t){"; os << ".stype = "; @@ -9918,14 +9062,17 @@ inline std::ostream &operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_exp_interop_semaphore_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_interop_semaphore_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_semaphore_desc_t params) { os << "(struct ur_exp_interop_semaphore_desc_t){"; os << ".stype = "; @@ -9935,14 +9082,17 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, - const struct ur_exp_layered_image_properties_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_layered_image_properties_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_layered_image_properties_t params) { os << "(struct ur_exp_layered_image_properties_t){"; os << ".stype = "; @@ -9952,7 +9102,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << ", "; os << ".numLayers = "; @@ -9962,8 +9113,11 @@ operator<<(std::ostream &os, os << "}"; return os; } -inline std::ostream & -operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_command_buffer_desc_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { os << "(struct ur_exp_command_buffer_desc_t){"; os << ".stype = "; @@ -9973,19 +9127,21 @@ operator<<(std::ostream &os, const struct ur_exp_command_buffer_desc_t params) { os << ", "; os << ".pNext = "; - printStruct(os, (params.pNext)); + details::printStruct(os, + (params.pNext)); os << "}"; return os; } -inline std::ostream &operator<<(std::ostream &os, - enum ur_exp_peer_info_t value) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_exp_peer_info_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value) { switch (value) { - case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: os << "UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED"; break; - case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: os << "UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED"; break; @@ -9995,22 +9151,21 @@ inline std::ostream &operator<<(std::ostream &os, } return os; } +namespace details { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print ur_exp_peer_info_t enum value template <> -inline void printTagged(std::ostream &os, const void *ptr, - ur_exp_peer_info_t value, size_t size) { +inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_exp_peer_info_t value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { - case UR_EXP_PEER_INFO_UR_PEER_ACCESS_SUPPORTED: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -10018,13 +9173,11 @@ inline void printTagged(std::ostream &os, const void *ptr, os << ")"; } break; - case UR_EXP_PEER_INFO_UR_PEER_ATOMICS_SUPPORTED: { const uint32_t *tptr = (const uint32_t *)ptr; if (sizeof(uint32_t) > size) { - os << "invalid size (is: " << size - << ", expected: >=" << sizeof(uint32_t) << ")"; - return; + os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t) << ")"; + return UR_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; @@ -10034,88 +9187,64 @@ inline void printTagged(std::ostream &os, const void *ptr, } break; default: os << "unknown enumerator"; - break; - } -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_adapter_get_params_t *params) { - - os << ".NumEntries = "; - - os << *(params->pNumEntries); - - os << ", "; - os << ".phAdapters = {"; - for (size_t i = 0; - *(params->pphAdapters) != NULL && i < *params->pNumEntries; ++i) { - if (i != 0) { - os << ", "; - } - - printPtr(os, (*(params->pphAdapters))[i]); + return UR_RESULT_ERROR_INVALID_ENUMERATION; } - os << "}"; - - os << ", "; - os << ".pNumAdapters = "; - - printPtr(os, *(params->ppNumAdapters)); - - return os; + return UR_RESULT_SUCCESS; } +} // namespace details -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_adapter_release_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_config_create_params_t *params) { - os << ".hAdapter = "; + os << ".phLoaderConfig = "; - printPtr(os, *(params->phAdapter)); + details::printPtr(os, + *(params->pphLoaderConfig)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_adapter_retain_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_config_retain_params_t *params) { - os << ".hAdapter = "; + os << ".hLoaderConfig = "; - printPtr(os, *(params->phAdapter)); + details::printPtr(os, + *(params->phLoaderConfig)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_adapter_get_last_error_params_t *params) { - - os << ".hAdapter = "; - - printPtr(os, *(params->phAdapter)); - - os << ", "; - os << ".ppMessage = "; - - printPtr(os, *(params->pppMessage)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_config_release_params_t *params) { - os << ", "; - os << ".pError = "; + os << ".hLoaderConfig = "; - printPtr(os, *(params->ppError)); + details::printPtr(os, + *(params->phLoaderConfig)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_adapter_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_config_get_info_params_t *params) { - os << ".hAdapter = "; + os << ".hLoaderConfig = "; - printPtr(os, *(params->phAdapter)); + details::printPtr(os, + *(params->phLoaderConfig)); os << ", "; os << ".propName = "; @@ -10129,288 +9258,312 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_enable_layer_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_config_enable_layer_params_t *params) { - os << ", "; - os << ".hDevice = "; + os << ".hLoaderConfig = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phLoaderConfig)); os << ", "; - os << ".hImage = "; + os << ".pLayerName = "; - printPtr(os, *(params->phImage)); + details::printPtr(os, + *(params->ppLayerName)); return os; } -inline std::ostream &operator<<( - std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_sampled_image_handle_destroy_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_config_set_code_location_callback_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_config_set_code_location_callback_params_t *params) { - os << ".hContext = "; + os << ".hLoaderConfig = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phLoaderConfig)); os << ", "; - os << ".hDevice = "; + os << ".pfnCodeloc = "; - printPtr(os, *(params->phDevice)); + os << reinterpret_cast( + *(params->ppfnCodeloc)); os << ", "; - os << ".hImage = "; + os << ".pUserData = "; - printPtr(os, *(params->phImage)); + details::printPtr(os, + *(params->ppUserData)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_allocate_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_get_params_t *params) { - os << ".hContext = "; + os << ".phAdapters = {"; + for (size_t i = 0; *(params->pphAdapters) != NULL && i < *params->pNumAdapters; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->phContext)); + details::printPtr(os, + (*(params->pphAdapters))[i]); + } + os << "}"; os << ", "; - os << ".hDevice = "; + os << ".NumAdapters = "; - printPtr(os, *(params->phDevice)); + os << *(params->pNumAdapters); os << ", "; - os << ".pImageFormat = "; + os << ".NumEntries = "; - printPtr(os, *(params->ppImageFormat)); + os << *(params->pNumEntries); os << ", "; - os << ".pImageDesc = "; + os << ".phPlatforms = {"; + for (size_t i = 0; *(params->pphPlatforms) != NULL && i < *params->pNumEntries; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->ppImageDesc)); + details::printPtr(os, + (*(params->pphPlatforms))[i]); + } + os << "}"; os << ", "; - os << ".phImageMem = "; + os << ".pNumPlatforms = "; - printPtr(os, *(params->pphImageMem)); + details::printPtr(os, + *(params->ppNumPlatforms)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_free_exp_params_t - *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_get_info_params_t *params) { - os << ", "; - os << ".hDevice = "; + os << ".hPlatform = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phPlatform)); os << ", "; - os << ".hImageMem = "; - - printPtr(os, *(params->phImageMem)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_unsampled_image_create_exp_params_t *params) { - - os << ".hContext = "; + os << ".propName = "; - printPtr(os, *(params->phContext)); + os << *(params->ppropName); os << ", "; - os << ".hDevice = "; + os << ".propSize = "; - printPtr(os, *(params->phDevice)); + os << *(params->ppropSize); os << ", "; - os << ".hImageMem = "; - - printPtr(os, *(params->phImageMem)); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".pImageFormat = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->ppImageFormat)); + details::printPtr(os, + *(params->ppPropSizeRet)); - os << ", "; - os << ".pImageDesc = "; + return os; +} - printPtr(os, *(params->ppImageDesc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_get_native_handle_params_t *params) { - os << ", "; - os << ".phMem = "; + os << ".hPlatform = "; - printPtr(os, *(params->pphMem)); + details::printPtr(os, + *(params->phPlatform)); os << ", "; - os << ".phImage = "; + os << ".phNativePlatform = "; - printPtr(os, *(params->pphImage)); + details::printPtr(os, + *(params->pphNativePlatform)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_sampled_image_create_exp_params_t *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); - - os << ", "; - os << ".hDevice = "; - - printPtr(os, *(params->phDevice)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_create_with_native_handle_params_t *params) { - os << ", "; - os << ".hImageMem = "; + os << ".hNativePlatform = "; - printPtr(os, *(params->phImageMem)); + details::printPtr(os, + *(params->phNativePlatform)); os << ", "; - os << ".pImageFormat = "; + os << ".pProperties = "; - printPtr(os, *(params->ppImageFormat)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".pImageDesc = "; + os << ".phPlatform = "; - printPtr(os, *(params->ppImageDesc)); + details::printPtr(os, + *(params->pphPlatform)); - os << ", "; - os << ".hSampler = "; + return os; +} - printPtr(os, *(params->phSampler)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_api_version_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_get_api_version_params_t *params) { - os << ", "; - os << ".phMem = "; + os << ".hPlatform = "; - printPtr(os, *(params->pphMem)); + details::printPtr(os, + *(params->phPlatform)); os << ", "; - os << ".phImage = "; + os << ".pVersion = "; - printPtr(os, *(params->pphImage)); + details::printPtr(os, + *(params->ppVersion)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_copy_exp_params_t - *params) { - - os << ".hQueue = "; - - printPtr(os, *(params->phQueue)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_platform_get_backend_option_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_get_backend_option_params_t *params) { - os << ", "; - os << ".pDst = "; + os << ".hPlatform = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->phPlatform)); os << ", "; - os << ".pSrc = "; + os << ".pFrontendOption = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppFrontendOption)); os << ", "; - os << ".pImageFormat = "; + os << ".ppPlatformOption = "; - printPtr(os, *(params->ppImageFormat)); + details::printPtr(os, + *(params->pppPlatformOption)); - os << ", "; - os << ".pImageDesc = "; + return os; +} - printPtr(os, *(params->ppImageDesc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_create_params_t *params) { - os << ", "; - os << ".imageCopyFlags = "; + os << ".DeviceCount = "; - printFlag(os, *(params->pimageCopyFlags)); + os << *(params->pDeviceCount); os << ", "; - os << ".srcOffset = "; + os << ".phDevices = {"; + for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pDeviceCount; ++i) { + if (i != 0) { + os << ", "; + } - os << *(params->psrcOffset); + details::printPtr(os, + (*(params->pphDevices))[i]); + } + os << "}"; os << ", "; - os << ".dstOffset = "; + os << ".pProperties = "; - os << *(params->pdstOffset); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".copyExtent = "; + os << ".phContext = "; - os << *(params->pcopyExtent); + details::printPtr(os, + *(params->pphContext)); - os << ", "; - os << ".hostExtent = "; + return os; +} - os << *(params->phostExtent); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_retain_params_t *params) { - os << ", "; - os << ".numEventsInWaitList = "; + os << ".hContext = "; - os << *(params->pnumEventsInWaitList); + details::printPtr(os, + *(params->phContext)); - os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + return os; +} - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_release_params_t *params) { - os << ", "; - os << ".phEvent = "; + os << ".hContext = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->phContext)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_get_info_params_t *params) { - os << ".hImageMem = "; + os << ".hContext = "; - printPtr(os, *(params->phImageMem)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".propName = "; @@ -10418,1445 +9571,2094 @@ inline std::ostream &operator<<( os << *(params->ppropName); os << ", "; - os << ".pPropValue = "; + os << ".propSize = "; + + os << *(params->ppropSize); - printPtr(os, *(params->ppPropValue)); + os << ", "; + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_mipmap_get_level_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_get_native_handle_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hDevice = "; + os << ".phNativeContext = "; + + details::printPtr(os, + *(params->pphNativeContext)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_create_with_native_handle_params_t *params) { + + os << ".hNativeContext = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phNativeContext)); os << ", "; - os << ".hImageMem = "; + os << ".numDevices = "; - printPtr(os, *(params->phImageMem)); + os << *(params->pnumDevices); os << ", "; - os << ".mipmapLevel = "; + os << ".phDevices = {"; + for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } - os << *(params->pmipmapLevel); + details::printPtr(os, + (*(params->pphDevices))[i]); + } + os << "}"; os << ", "; - os << ".phImageMem = "; + os << ".pProperties = "; + + details::printPtr(os, + *(params->ppProperties)); + + os << ", "; + os << ".phContext = "; - printPtr(os, *(params->pphImageMem)); + details::printPtr(os, + *(params->pphContext)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_bindless_images_mipmap_free_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_context_set_extended_deleter_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_set_extended_deleter_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hDevice = "; + os << ".pfnDeleter = "; - printPtr(os, *(params->phDevice)); + os << reinterpret_cast( + *(params->ppfnDeleter)); os << ", "; - os << ".hMem = "; + os << ".pUserData = "; - printPtr(os, *(params->phMem)); + details::printPtr(os, + *(params->ppUserData)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_import_opaque_fd_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_get_info_params_t *params) { - os << ".hContext = "; + os << ".hEvent = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phEvent)); os << ", "; - os << ".hDevice = "; + os << ".propName = "; - printPtr(os, *(params->phDevice)); + os << *(params->ppropName); os << ", "; - os << ".size = "; + os << ".propSize = "; - os << *(params->psize); + os << *(params->ppropSize); os << ", "; - os << ".pInteropMemDesc = "; - - printPtr(os, *(params->ppInteropMemDesc)); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".phInteropMem = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->pphInteropMem)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_map_external_array_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_get_profiling_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_get_profiling_info_params_t *params) { - os << ".hContext = "; + os << ".hEvent = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phEvent)); os << ", "; - os << ".hDevice = "; + os << ".propName = "; - printPtr(os, *(params->phDevice)); + os << *(params->ppropName); os << ", "; - os << ".pImageFormat = "; + os << ".propSize = "; - printPtr(os, *(params->ppImageFormat)); + os << *(params->ppropSize); os << ", "; - os << ".pImageDesc = "; - - printPtr(os, *(params->ppImageDesc)); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".hInteropMem = "; - - printPtr(os, *(params->phInteropMem)); - - os << ", "; - os << ".phImageMem = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->pphImageMem)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_release_interop_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_wait_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_wait_params_t *params) { - os << ".hContext = "; + os << ".numEvents = "; - printPtr(os, *(params->phContext)); + os << *(params->pnumEvents); os << ", "; - os << ".hDevice = "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEvents; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->phDevice)); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; - os << ", "; - os << ".hInteropMem = "; + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_retain_params_t *params) { - printPtr(os, *(params->phInteropMem)); + os << ".hEvent = "; + + details::printPtr(os, + *(params->phEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_import_external_semaphore_opaque_fd_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_release_params_t *params) { - os << ".hContext = "; + os << ".hEvent = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phEvent)); - os << ", "; - os << ".hDevice = "; + return os; +} - printPtr(os, *(params->phDevice)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_get_native_handle_params_t *params) { - os << ", "; - os << ".pInteropSemaphoreDesc = "; + os << ".hEvent = "; - printPtr(os, *(params->ppInteropSemaphoreDesc)); + details::printPtr(os, + *(params->phEvent)); os << ", "; - os << ".phInteropSemaphore = "; + os << ".phNativeEvent = "; - printPtr(os, *(params->pphInteropSemaphore)); + details::printPtr(os, + *(params->pphNativeEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_destroy_external_semaphore_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_create_with_native_handle_params_t *params) { + + os << ".hNativeEvent = "; + + details::printPtr(os, + *(params->phNativeEvent)); + os << ", "; os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hDevice = "; + os << ".pProperties = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".hInteropSemaphore = "; + os << ".phEvent = "; - printPtr(os, *(params->phInteropSemaphore)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_wait_external_semaphore_exp_params_t *params) { - - os << ".hQueue = "; - - printPtr(os, *(params->phQueue)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_event_set_callback_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_set_callback_params_t *params) { - os << ", "; - os << ".hSemaphore = "; + os << ".hEvent = "; - printPtr(os, *(params->phSemaphore)); + details::printPtr(os, + *(params->phEvent)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".execStatus = "; - os << *(params->pnumEventsInWaitList); + os << *(params->pexecStatus); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".pfnNotify = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + os << reinterpret_cast( + *(params->ppfnNotify)); os << ", "; - os << ".phEvent = "; + os << ".pUserData = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppUserData)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_bindless_images_signal_external_semaphore_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_create_with_il_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_create_with_il_params_t *params) { - os << ".hQueue = "; + os << ".hContext = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hSemaphore = "; + os << ".pIL = "; - printPtr(os, *(params->phSemaphore)); + details::printPtr(os, + *(params->ppIL)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".length = "; - os << *(params->pnumEventsInWaitList); + os << *(params->plength); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".pProperties = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".phEvent = "; + os << ".phProgram = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphProgram)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_create_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_create_with_binary_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_create_with_binary_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pCommandBufferDesc = "; + os << ".size = "; - printPtr(os, *(params->ppCommandBufferDesc)); + os << *(params->psize); os << ", "; - os << ".phCommandBuffer = "; + os << ".pBinary = "; - printPtr(os, *(params->pphCommandBuffer)); + details::printPtr(os, + *(params->ppBinary)); - return os; -} + os << ", "; + os << ".pProperties = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_retain_exp_params_t - *params) { + details::printPtr(os, + *(params->ppProperties)); - os << ".hCommandBuffer = "; + os << ", "; + os << ".phProgram = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->pphProgram)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_release_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_build_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hContext = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phContext)); - return os; -} + os << ", "; + os << ".hProgram = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_finalize_exp_params_t - *params) { + details::printPtr(os, + *(params->phProgram)); - os << ".hCommandBuffer = "; + os << ", "; + os << ".pOptions = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->ppOptions)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_kernel_launch_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_compile_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_compile_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hContext = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hKernel = "; + os << ".hProgram = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".workDim = "; + os << ".pOptions = "; - os << *(params->pworkDim); + details::printPtr(os, + *(params->ppOptions)); - os << ", "; - os << ".pGlobalWorkOffset = "; + return os; +} - printPtr(os, *(params->ppGlobalWorkOffset)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_link_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_link_params_t *params) { - os << ", "; - os << ".pGlobalWorkSize = "; + os << ".hContext = "; - printPtr(os, *(params->ppGlobalWorkSize)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pLocalWorkSize = "; + os << ".count = "; - printPtr(os, *(params->ppLocalWorkSize)); + os << *(params->pcount); os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".phPrograms = {"; + for (size_t i = 0; *(params->pphPrograms) != NULL && i < *params->pcount; ++i) { + if (i != 0) { + os << ", "; + } - os << *(params->pnumSyncPointsInWaitList); + details::printPtr(os, + (*(params->pphPrograms))[i]); + } + os << "}"; os << ", "; - os << ".pSyncPointWaitList = "; + os << ".pOptions = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->ppOptions)); os << ", "; - os << ".pSyncPoint = "; + os << ".phProgram = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->pphProgram)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_usm_memcpy_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_retain_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hProgram = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phProgram)); - os << ", "; - os << ".pDst = "; + return os; +} - printPtr(os, *(params->ppDst)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_release_params_t *params) { - os << ", "; - os << ".pSrc = "; + os << ".hProgram = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->phProgram)); - os << ", "; - os << ".size = "; + return os; +} - os << *(params->psize); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_function_pointer_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_get_function_pointer_params_t *params) { + + os << ".hDevice = "; + + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".hProgram = "; - os << *(params->pnumSyncPointsInWaitList); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".pSyncPointWaitList = "; + os << ".pFunctionName = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->ppFunctionName)); os << ", "; - os << ".pSyncPoint = "; + os << ".ppFunctionPointer = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->pppFunctionPointer)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_append_usm_fill_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_get_info_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hProgram = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".pMemory = "; + os << ".propName = "; - printPtr(os, *(params->ppMemory)); + os << *(params->ppropName); os << ", "; - os << ".pPattern = "; + os << ".propSize = "; - printPtr(os, *(params->ppPattern)); + os << *(params->ppropSize); os << ", "; - os << ".patternSize = "; - - os << *(params->ppatternSize); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".size = "; + os << ".pPropSizeRet = "; - os << *(params->psize); + details::printPtr(os, + *(params->ppPropSizeRet)); - os << ", "; - os << ".numSyncPointsInWaitList = "; + return os; +} - os << *(params->pnumSyncPointsInWaitList); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_build_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_get_build_info_params_t *params) { - os << ", "; - os << ".pSyncPointWaitList = "; + os << ".hProgram = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".pSyncPoint = "; + os << ".hDevice = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->phDevice)); - return os; -} + os << ", "; + os << ".propName = "; -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_copy_exp_params_t *params) { + os << *(params->ppropName); - os << ".hCommandBuffer = "; + os << ", "; + os << ".propSize = "; - printPtr(os, *(params->phCommandBuffer)); + os << *(params->ppropSize); os << ", "; - os << ".hSrcMem = "; - - printPtr(os, *(params->phSrcMem)); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".hDstMem = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->phDstMem)); + details::printPtr(os, + *(params->ppPropSizeRet)); - os << ", "; - os << ".srcOffset = "; + return os; +} - os << *(params->psrcOffset); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_set_specialization_constants_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_set_specialization_constants_params_t *params) { - os << ", "; - os << ".dstOffset = "; + os << ".hProgram = "; - os << *(params->pdstOffset); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".size = "; + os << ".count = "; - os << *(params->psize); + os << *(params->pcount); os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".pSpecConstants = {"; + for (size_t i = 0; *(params->ppSpecConstants) != NULL && i < *params->pcount; ++i) { + if (i != 0) { + os << ", "; + } - os << *(params->pnumSyncPointsInWaitList); + os << (*(params->ppSpecConstants))[i]; + } + os << "}"; - os << ", "; - os << ".pSyncPointWaitList = "; + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_get_native_handle_params_t *params) { + + os << ".hProgram = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".pSyncPoint = "; + os << ".phNativeProgram = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->pphNativeProgram)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_write_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_create_with_native_handle_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hNativeProgram = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phNativeProgram)); os << ", "; - os << ".hBuffer = "; + os << ".hContext = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".offset = "; + os << ".pProperties = "; - os << *(params->poffset); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".size = "; + os << ".phProgram = "; - os << *(params->psize); + details::printPtr(os, + *(params->pphProgram)); - os << ", "; - os << ".pSrc = "; + return os; +} - printPtr(os, *(params->ppSrc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_create_params_t *params) { - os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".hProgram = "; - os << *(params->pnumSyncPointsInWaitList); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".pSyncPointWaitList = "; + os << ".pKernelName = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->ppKernelName)); os << ", "; - os << ".pSyncPoint = "; + os << ".phKernel = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->pphKernel)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_read_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_get_info_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hKernel = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".hBuffer = "; + os << ".propName = "; - printPtr(os, *(params->phBuffer)); + os << *(params->ppropName); os << ", "; - os << ".offset = "; + os << ".propSize = "; - os << *(params->poffset); + os << *(params->ppropSize); os << ", "; - os << ".size = "; - - os << *(params->psize); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".pDst = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppPropSizeRet)); - os << ", "; - os << ".numSyncPointsInWaitList = "; + return os; +} - os << *(params->pnumSyncPointsInWaitList); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_group_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_get_group_info_params_t *params) { - os << ", "; - os << ".pSyncPointWaitList = "; + os << ".hKernel = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".pSyncPoint = "; + os << ".hDevice = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->phDevice)); - return os; -} + os << ", "; + os << ".propName = "; -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *params) { + os << *(params->ppropName); - os << ".hCommandBuffer = "; + os << ", "; + os << ".propSize = "; - printPtr(os, *(params->phCommandBuffer)); + os << *(params->ppropSize); os << ", "; - os << ".hSrcMem = "; - - printPtr(os, *(params->phSrcMem)); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".hDstMem = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->phDstMem)); + details::printPtr(os, + *(params->ppPropSizeRet)); - os << ", "; - os << ".srcOrigin = "; + return os; +} - os << *(params->psrcOrigin); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_sub_group_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_get_sub_group_info_params_t *params) { - os << ", "; - os << ".dstOrigin = "; + os << ".hKernel = "; - os << *(params->pdstOrigin); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".region = "; + os << ".hDevice = "; - os << *(params->pregion); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".srcRowPitch = "; + os << ".propName = "; - os << *(params->psrcRowPitch); + os << *(params->ppropName); os << ", "; - os << ".srcSlicePitch = "; + os << ".propSize = "; - os << *(params->psrcSlicePitch); + os << *(params->ppropSize); os << ", "; - os << ".dstRowPitch = "; - - os << *(params->pdstRowPitch); + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".dstSlicePitch = "; + os << ".pPropSizeRet = "; - os << *(params->pdstSlicePitch); + details::printPtr(os, + *(params->ppPropSizeRet)); - os << ", "; - os << ".numSyncPointsInWaitList = "; + return os; +} - os << *(params->pnumSyncPointsInWaitList); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_retain_params_t *params) { - os << ", "; - os << ".pSyncPointWaitList = "; + os << ".hKernel = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->phKernel)); - os << ", "; - os << ".pSyncPoint = "; + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_release_params_t *params) { + + os << ".hKernel = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->phKernel)); return os; } -inline std::ostream &operator<<( - std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_get_native_handle_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hKernel = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".hBuffer = "; + os << ".phNativeKernel = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->pphNativeKernel)); - os << ", "; - os << ".bufferOffset = "; + return os; +} - os << *(params->pbufferOffset); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_create_with_native_handle_params_t *params) { - os << ", "; - os << ".hostOffset = "; + os << ".hNativeKernel = "; - os << *(params->phostOffset); + details::printPtr(os, + *(params->phNativeKernel)); os << ", "; - os << ".region = "; + os << ".hContext = "; - os << *(params->pregion); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".bufferRowPitch = "; + os << ".hProgram = "; - os << *(params->pbufferRowPitch); + details::printPtr(os, + *(params->phProgram)); os << ", "; - os << ".bufferSlicePitch = "; + os << ".pProperties = "; - os << *(params->pbufferSlicePitch); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".hostRowPitch = "; + os << ".phKernel = "; - os << *(params->phostRowPitch); + details::printPtr(os, + *(params->pphKernel)); - os << ", "; - os << ".hostSlicePitch = "; + return os; +} - os << *(params->phostSlicePitch); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_value_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_arg_value_params_t *params) { + + os << ".hKernel = "; + + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".pSrc = "; + os << ".argIndex = "; - printPtr(os, *(params->ppSrc)); + os << *(params->pargIndex); os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".argSize = "; - os << *(params->pnumSyncPointsInWaitList); + os << *(params->pargSize); os << ", "; - os << ".pSyncPointWaitList = "; + os << ".pProperties = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".pSyncPoint = "; + os << ".pArgValue = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->ppArgValue)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_local_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_arg_local_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hKernel = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".hBuffer = "; + os << ".argIndex = "; - printPtr(os, *(params->phBuffer)); + os << *(params->pargIndex); os << ", "; - os << ".bufferOffset = "; + os << ".argSize = "; - os << *(params->pbufferOffset); + os << *(params->pargSize); os << ", "; - os << ".hostOffset = "; + os << ".pProperties = "; - os << *(params->phostOffset); + details::printPtr(os, + *(params->ppProperties)); - os << ", "; - os << ".region = "; + return os; +} - os << *(params->pregion); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_pointer_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_arg_pointer_params_t *params) { - os << ", "; - os << ".bufferRowPitch = "; + os << ".hKernel = "; - os << *(params->pbufferRowPitch); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".bufferSlicePitch = "; + os << ".argIndex = "; - os << *(params->pbufferSlicePitch); + os << *(params->pargIndex); os << ", "; - os << ".hostRowPitch = "; + os << ".pProperties = "; - os << *(params->phostRowPitch); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".hostSlicePitch = "; + os << ".pArgValue = "; - os << *(params->phostSlicePitch); + details::printPtr(os, + *(params->ppArgValue)); - os << ", "; - os << ".pDst = "; + return os; +} - printPtr(os, *(params->ppDst)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_exec_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_exec_info_params_t *params) { + + os << ".hKernel = "; + + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".propName = "; - os << *(params->pnumSyncPointsInWaitList); + os << *(params->ppropName); os << ", "; - os << ".pSyncPointWaitList = "; + os << ".propSize = "; - printPtr(os, *(params->ppSyncPointWaitList)); + os << *(params->ppropSize); os << ", "; - os << ".pSyncPoint = "; + os << ".pProperties = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->ppProperties)); + + os << ", "; + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_mem_buffer_fill_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_sampler_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_arg_sampler_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hKernel = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".hBuffer = "; + os << ".argIndex = "; - printPtr(os, *(params->phBuffer)); + os << *(params->pargIndex); os << ", "; - os << ".pPattern = "; + os << ".pProperties = "; - printPtr(os, *(params->ppPattern)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".patternSize = "; + os << ".hArgValue = "; - os << *(params->ppatternSize); + details::printPtr(os, + *(params->phArgValue)); - os << ", "; - os << ".offset = "; + return os; +} - os << *(params->poffset); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_arg_mem_obj_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_arg_mem_obj_params_t *params) { - os << ", "; - os << ".size = "; + os << ".hKernel = "; - os << *(params->psize); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".argIndex = "; - os << *(params->pnumSyncPointsInWaitList); + os << *(params->pargIndex); os << ", "; - os << ".pSyncPointWaitList = "; + os << ".pProperties = "; - printPtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".pSyncPoint = "; + os << ".hArgValue = "; - printPtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->phArgValue)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_usm_prefetch_exp_params_t *params) { - - os << ".hCommandBuffer = "; - - ur_params::serializePtr(os, *(params->phCommandBuffer)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_set_specialization_constants_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_set_specialization_constants_params_t *params) { - os << ", "; - os << ".pMemory = "; + os << ".hKernel = "; - ur_params::serializePtr(os, *(params->ppMemory)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".size = "; + os << ".count = "; - os << *(params->psize); + os << *(params->pcount); os << ", "; - os << ".flags = "; + os << ".pSpecConstants = "; - ur_params::serializeFlag(os, *(params->pflags)); + details::printPtr(os, + *(params->ppSpecConstants)); - os << ", "; - os << ".numSyncPointsInWaitList = "; + return os; +} - os << *(params->pnumSyncPointsInWaitList); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_kernel_suggest_max_cooperative_group_count_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t *params) { - os << ", "; - os << ".pSyncPointWaitList = "; + os << ".hKernel = "; - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".pSyncPoint = "; + os << ".pGroupCountRet = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->ppGroupCountRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_command_buffer_append_usm_advise_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_create_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hContext = "; - ur_params::serializePtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pMemory = "; + os << ".pDesc = "; - ur_params::serializePtr(os, *(params->ppMemory)); + details::printPtr(os, + *(params->ppDesc)); os << ", "; - os << ".size = "; + os << ".phSampler = "; - os << *(params->psize); + details::printPtr(os, + *(params->pphSampler)); - os << ", "; - os << ".advice = "; + return os; +} - ur_params::serializeFlag(os, *(params->padvice)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_retain_params_t *params) { - os << ", "; - os << ".numSyncPointsInWaitList = "; + os << ".hSampler = "; - os << *(params->pnumSyncPointsInWaitList); + details::printPtr(os, + *(params->phSampler)); - os << ", "; - os << ".pSyncPointWaitList = "; + return os; +} - ur_params::serializePtr(os, *(params->ppSyncPointWaitList)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_release_params_t *params) { - os << ", "; - os << ".pSyncPoint = "; + os << ".hSampler = "; - ur_params::serializePtr(os, *(params->ppSyncPoint)); + details::printPtr(os, + *(params->phSampler)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_get_info_params_t *params) { - os << ".hCommandBuffer = "; + os << ".hSampler = "; - printPtr(os, *(params->phCommandBuffer)); + details::printPtr(os, + *(params->phSampler)); os << ", "; - os << ".hQueue = "; + os << ".propName = "; - printPtr(os, *(params->phQueue)); + os << *(params->ppropName); os << ", "; - os << ".numEventsInWaitList = "; + os << ".propSize = "; - os << *(params->pnumEventsInWaitList); + os << *(params->ppropSize); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } - - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; - os << ".phEvent = "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_create_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_get_native_handle_params_t *params) { - os << ".DeviceCount = "; + os << ".hSampler = "; - os << *(params->pDeviceCount); + details::printPtr(os, + *(params->phSampler)); os << ", "; - os << ".phDevices = {"; - for (size_t i = 0; - *(params->pphDevices) != NULL && i < *params->pDeviceCount; ++i) { - if (i != 0) { - os << ", "; - } + os << ".phNativeSampler = "; - printPtr(os, (*(params->pphDevices))[i]); - } - os << "}"; + details::printPtr(os, + *(params->pphNativeSampler)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_sampler_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_create_with_native_handle_params_t *params) { + + os << ".hNativeSampler = "; + + details::printPtr(os, + *(params->phNativeSampler)); + + os << ", "; + os << ".hContext = "; + + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pProperties = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".phContext = "; + os << ".phSampler = "; - printPtr(os, *(params->pphContext)); + details::printPtr(os, + *(params->pphSampler)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_retain_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_image_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_image_create_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); - return os; -} + os << ", "; + os << ".flags = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_release_params_t *params) { + details::printFlag(os, + *(params->pflags)); - os << ".hContext = "; + os << ", "; + os << ".pImageFormat = "; + + details::printPtr(os, + *(params->ppImageFormat)); + + os << ", "; + os << ".pImageDesc = "; + + details::printPtr(os, + *(params->ppImageDesc)); - printPtr(os, *(params->phContext)); + os << ", "; + os << ".pHost = "; + + details::printPtr(os, + *(params->ppHost)); + + os << ", "; + os << ".phMem = "; + + details::printPtr(os, + *(params->pphMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_buffer_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_buffer_create_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".propName = "; + os << ".flags = "; - os << *(params->ppropName); + details::printFlag(os, + *(params->pflags)); os << ", "; - os << ".propSize = "; + os << ".size = "; - os << *(params->ppropSize); + os << *(params->psize); os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".pProperties = "; + + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".pPropSizeRet = "; + os << ".phBuffer = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->pphBuffer)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_context_get_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_retain_params_t *params) { - os << ".hContext = "; + os << ".hMem = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phMem)); - os << ", "; - os << ".phNativeContext = "; + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_release_params_t *params) { + + os << ".hMem = "; - printPtr(os, *(params->pphNativeContext)); + details::printPtr(os, + *(params->phMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_context_create_with_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_buffer_partition_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_buffer_partition_params_t *params) { - os << ".hNativeContext = "; + os << ".hBuffer = "; - printPtr(os, *(params->phNativeContext)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; - os << ".numDevices = "; + os << ".flags = "; - os << *(params->pnumDevices); + details::printFlag(os, + *(params->pflags)); os << ", "; - os << ".phDevices = {"; - for (size_t i = 0; - *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) { - if (i != 0) { - os << ", "; - } + os << ".bufferCreateType = "; - printPtr(os, (*(params->pphDevices))[i]); - } - os << "}"; + os << *(params->pbufferCreateType); os << ", "; - os << ".pProperties = "; + os << ".pRegion = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppRegion)); os << ", "; - os << ".phContext = "; + os << ".phMem = "; - printPtr(os, *(params->pphContext)); + details::printPtr(os, + *(params->pphMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_context_set_extended_deleter_params_t - *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_get_native_handle_params_t *params) { - os << ", "; - os << ".pfnDeleter = "; + os << ".hMem = "; - os << reinterpret_cast(*(params->ppfnDeleter)); + details::printPtr(os, + *(params->phMem)); os << ", "; - os << ".pUserData = "; + os << ".phNativeMem = "; - printPtr(os, *(params->ppUserData)); + details::printPtr(os, + *(params->pphNativeMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_kernel_launch_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_buffer_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_buffer_create_with_native_handle_params_t *params) { - os << ".hQueue = "; + os << ".hNativeMem = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phNativeMem)); os << ", "; - os << ".hKernel = "; + os << ".hContext = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".workDim = "; + os << ".pProperties = "; - os << *(params->pworkDim); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".pGlobalWorkOffset = "; + os << ".phMem = "; + + details::printPtr(os, + *(params->pphMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_image_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_image_create_with_native_handle_params_t *params) { + + os << ".hNativeMem = "; - printPtr(os, *(params->ppGlobalWorkOffset)); + details::printPtr(os, + *(params->phNativeMem)); os << ", "; - os << ".pGlobalWorkSize = "; + os << ".hContext = "; - printPtr(os, *(params->ppGlobalWorkSize)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pLocalWorkSize = "; + os << ".pImageFormat = "; - printPtr(os, *(params->ppLocalWorkSize)); + details::printPtr(os, + *(params->ppImageFormat)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".pImageDesc = "; - os << *(params->pnumEventsInWaitList); + details::printPtr(os, + *(params->ppImageDesc)); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".pProperties = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".phEvent = "; + os << ".phMem = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_events_wait_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_get_info_params_t *params) { - os << ".hQueue = "; + os << ".hMemory = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phMemory)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".propName = "; - os << *(params->pnumEventsInWaitList); + os << *(params->ppropName); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".propSize = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + os << *(params->ppropSize); os << ", "; - os << ".phEvent = "; + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_events_wait_with_barrier_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_mem_image_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_image_get_info_params_t *params) { - os << ".hQueue = "; + os << ".hMemory = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phMemory)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".propName = "; - os << *(params->pnumEventsInWaitList); + os << *(params->ppropName); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".propSize = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + os << *(params->ppropSize); os << ", "; - os << ".phEvent = "; + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_create_params_t *params) { - os << ".hQueue = "; + os << ".hContext = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hBuffer = "; + os << ".hDevice = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".blockingRead = "; + os << ".size = "; - os << *(params->pblockingRead); + os << *(params->psize); os << ", "; - os << ".offset = "; + os << ".pProperties = "; - os << *(params->poffset); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".size = "; + os << ".phPhysicalMem = "; - os << *(params->psize); + details::printPtr(os, + *(params->pphPhysicalMem)); - os << ", "; - os << ".pDst = "; + return os; +} - printPtr(os, *(params->ppDst)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_retain_params_t *params) { - os << ", "; - os << ".numEventsInWaitList = "; + os << ".hPhysicalMem = "; - os << *(params->pnumEventsInWaitList); + details::printPtr(os, + *(params->phPhysicalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_physical_mem_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_release_params_t *params) { + + os << ".hPhysicalMem = "; + + details::printPtr(os, + *(params->phPhysicalMem)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_get_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_get_params_t *params) { + + os << ".NumEntries = "; + + os << *(params->pNumEntries); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + os << ".phAdapters = {"; + for (size_t i = 0; *(params->pphAdapters) != NULL && i < *params->pNumEntries; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphAdapters))[i]); } os << "}"; os << ", "; - os << ".phEvent = "; + os << ".pNumAdapters = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppNumAdapters)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_release_params_t *params) { - os << ".hQueue = "; + os << ".hAdapter = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phAdapter)); - os << ", "; - os << ".hBuffer = "; + return os; +} - printPtr(os, *(params->phBuffer)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_retain_params_t *params) { - os << ", "; - os << ".blockingWrite = "; + os << ".hAdapter = "; - os << *(params->pblockingWrite); + details::printPtr(os, + *(params->phAdapter)); - os << ", "; - os << ".offset = "; + return os; +} - os << *(params->poffset); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_get_last_error_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_get_last_error_params_t *params) { + + os << ".hAdapter = "; + + details::printPtr(os, + *(params->phAdapter)); os << ", "; - os << ".size = "; + os << ".ppMessage = "; - os << *(params->psize); + details::printPtr(os, + *(params->pppMessage)); os << ", "; - os << ".pSrc = "; + os << ".pError = "; + + details::printPtr(os, + *(params->ppError)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_adapter_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_adapter_get_info_params_t *params) { + + os << ".hAdapter = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->phAdapter)); os << ", "; - os << ".numEventsInWaitList = "; + os << ".propName = "; - os << *(params->pnumEventsInWaitList); + os << *(params->ppropName); os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".propSize = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + os << *(params->ppropSize); os << ", "; - os << ".phEvent = "; + os << ".pPropValue = "; + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + + os << ", "; + os << ".pPropSizeRet = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_rect_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_kernel_launch_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_kernel_launch_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; - os << ".hBuffer = "; + os << ".hKernel = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".blockingRead = "; + os << ".workDim = "; - os << *(params->pblockingRead); + os << *(params->pworkDim); + + os << ", "; + os << ".pGlobalWorkOffset = "; + + details::printPtr(os, + *(params->ppGlobalWorkOffset)); + + os << ", "; + os << ".pGlobalWorkSize = "; + + details::printPtr(os, + *(params->ppGlobalWorkSize)); + + os << ", "; + os << ".pLocalWorkSize = "; + + details::printPtr(os, + *(params->ppLocalWorkSize)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; + + os << ", "; + os << ".phEvent = "; + + details::printPtr(os, + *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_events_wait_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_events_wait_params_t *params) { + + os << ".hQueue = "; + + details::printPtr(os, + *(params->phQueue)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; + + os << ", "; + os << ".phEvent = "; + + details::printPtr(os, + *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_events_wait_with_barrier_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_events_wait_with_barrier_params_t *params) { + + os << ".hQueue = "; + + details::printPtr(os, + *(params->phQueue)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; + + os << ", "; + os << ".phEvent = "; + + details::printPtr(os, + *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_read_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_params_t *params) { + + os << ".hQueue = "; + + details::printPtr(os, + *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + details::printPtr(os, + *(params->phBuffer)); + + os << ", "; + os << ".blockingRead = "; + + os << *(params->pblockingRead); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pDst = "; + + details::printPtr(os, + *(params->ppDst)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; + + os << ", "; + os << ".phEvent = "; + + details::printPtr(os, + *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_write_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_params_t *params) { + + os << ".hQueue = "; + + details::printPtr(os, + *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + details::printPtr(os, + *(params->phBuffer)); + + os << ", "; + os << ".blockingWrite = "; + + os << *(params->pblockingWrite); + + os << ", "; + os << ".offset = "; + + os << *(params->poffset); + + os << ", "; + os << ".size = "; + + os << *(params->psize); + + os << ", "; + os << ".pSrc = "; + + details::printPtr(os, + *(params->ppSrc)); + + os << ", "; + os << ".numEventsInWaitList = "; + + os << *(params->pnumEventsInWaitList); + + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; + + os << ", "; + os << ".phEvent = "; + + details::printPtr(os, + *(params->pphEvent)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_read_rect_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_read_rect_params_t *params) { + + os << ".hQueue = "; + + details::printPtr(os, + *(params->phQueue)); + + os << ", "; + os << ".hBuffer = "; + + details::printPtr(os, + *(params->phBuffer)); + + os << ", "; + os << ".blockingRead = "; + + os << *(params->pblockingRead); os << ", "; os << ".bufferOrigin = "; @@ -11896,7 +11698,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11905,38 +11708,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_rect_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_write_rect_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_write_rect_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -11981,7 +11787,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -11990,42 +11797,47 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_copy_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - printPtr(os, *(params->phBufferSrc)); + details::printPtr(os, + *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - printPtr(os, *(params->phBufferDst)); + details::printPtr(os, + *(params->phBufferDst)); os << ", "; os << ".srcOffset = "; @@ -12049,43 +11861,47 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_rect_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_copy_rect_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_copy_rect_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - printPtr(os, *(params->phBufferSrc)); + details::printPtr(os, + *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - printPtr(os, *(params->phBufferDst)); + details::printPtr(os, + *(params->phBufferDst)); os << ", "; os << ".srcOrigin = "; @@ -12129,42 +11945,47 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_fill_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_fill_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_fill_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".pPattern = "; - printPtr(os, *(params->ppPattern)); + details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -12188,37 +12009,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_image_read_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_image_read_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_image_read_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hImage = "; - printPtr(os, *(params->phImage)); + details::printPtr(os, + *(params->phImage)); os << ", "; os << ".blockingRead = "; @@ -12248,7 +12073,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -12257,37 +12083,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_image_write_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_image_write_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_image_write_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hImage = "; - printPtr(os, *(params->phImage)); + details::printPtr(os, + *(params->phImage)); os << ", "; os << ".blockingWrite = "; @@ -12317,7 +12147,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12326,42 +12157,47 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_image_copy_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_image_copy_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_image_copy_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hImageSrc = "; - printPtr(os, *(params->phImageSrc)); + details::printPtr(os, + *(params->phImageSrc)); os << ", "; os << ".hImageDst = "; - printPtr(os, *(params->phImageDst)); + details::printPtr(os, + *(params->phImageDst)); os << ", "; os << ".srcOrigin = "; @@ -12385,37 +12221,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_buffer_map_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_buffer_map_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_buffer_map_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingMap = "; @@ -12425,7 +12265,8 @@ inline std::ostream &operator<<( os << ", "; os << ".mapFlags = "; - printFlag(os, *(params->pmapFlags)); + details::printFlag(os, + *(params->pmapFlags)); os << ", "; os << ".offset = "; @@ -12444,47 +12285,53 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); os << ", "; os << ".ppRetMap = "; - printPtr(os, *(params->pppRetMap)); + details::printPtr(os, + *(params->pppRetMap)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_mem_unmap_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_mem_unmap_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_mem_unmap_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hMem = "; - printPtr(os, *(params->phMem)); + details::printPtr(os, + *(params->phMem)); os << ", "; os << ".pMappedPtr = "; - printPtr(os, *(params->ppMappedPtr)); + details::printPtr(os, + *(params->ppMappedPtr)); os << ", "; os << ".numEventsInWaitList = "; @@ -12493,37 +12340,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_usm_fill_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_fill_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_usm_fill_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".ptr = "; - printPtr(os, *(params->pptr)); + details::printPtr(os, + *(params->pptr)); os << ", "; os << ".patternSize = "; @@ -12533,7 +12384,8 @@ operator<<(std::ostream &os, os << ", "; os << ".pPattern = "; - printPtr(os, *(params->ppPattern)); + details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".size = "; @@ -12547,32 +12399,35 @@ operator<<(std::ostream &os, os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_usm_memcpy_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_memcpy_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_usm_memcpy_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12582,12 +12437,14 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".pSrc = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".size = "; @@ -12601,37 +12458,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_usm_prefetch_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_prefetch_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_usm_prefetch_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pMem = "; - printPtr(os, *(params->ppMem)); + details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".size = "; @@ -12641,7 +12502,8 @@ inline std::ostream &operator<<( os << ", "; os << ".flags = "; - printFlag(os, *(params->pflags)); + details::printFlag(os, + *(params->pflags)); os << ", "; os << ".numEventsInWaitList = "; @@ -12650,37 +12512,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_usm_advise_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_advise_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_usm_advise_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pMem = "; - printPtr(os, *(params->ppMem)); + details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".size = "; @@ -12690,28 +12556,34 @@ inline std::ostream &operator<<( os << ", "; os << ".advice = "; - printFlag(os, *(params->padvice)); + details::printFlag(os, + *(params->padvice)); os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_usm_fill_2d_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_fill_2d_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_usm_fill_2d_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pMem = "; - printPtr(os, *(params->ppMem)); + details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".pitch = "; @@ -12726,7 +12598,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pPattern = "; - printPtr(os, *(params->ppPattern)); + details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".width = "; @@ -12745,32 +12618,35 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_usm_memcpy_2d_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_usm_memcpy_2d_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_usm_memcpy_2d_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12780,7 +12656,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".dstPitch = "; @@ -12790,7 +12667,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".srcPitch = "; @@ -12814,42 +12692,47 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_enqueue_device_global_variable_write_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_device_global_variable_write_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_device_global_variable_write_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".name = "; - printPtr(os, *(params->pname)); + details::printPtr(os, + *(params->pname)); os << ", "; os << ".blockingWrite = "; @@ -12869,7 +12752,8 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12878,42 +12762,47 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_enqueue_device_global_variable_read_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_device_global_variable_read_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_device_global_variable_read_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".name = "; - printPtr(os, *(params->pname)); + details::printPtr(os, + *(params->pname)); os << ", "; os << ".blockingRead = "; @@ -12933,7 +12822,8 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -12942,42 +12832,47 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_read_host_pipe_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_read_host_pipe_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_read_host_pipe_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - printPtr(os, *(params->ppipe_symbol)); + details::printPtr(os, + *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -12987,7 +12882,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pDst = "; - printPtr(os, *(params->ppDst)); + details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".size = "; @@ -13001,42 +12897,47 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_enqueue_write_host_pipe_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_write_host_pipe_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_write_host_pipe_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - printPtr(os, *(params->ppipe_symbol)); + details::printPtr(os, + *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13046,7 +12947,8 @@ inline std::ostream &operator<<( os << ", "; os << ".pSrc = "; - printPtr(os, *(params->ppSrc)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".size = "; @@ -13060,37 +12962,41 @@ inline std::ostream &operator<<( os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_enqueue_cooperative_kernel_launch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *params) { os << ".hQueue = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hKernel = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -13100,17 +13006,20 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - printPtr(os, *(params->ppGlobalWorkOffset)); + details::printPtr(os, + *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - printPtr(os, *(params->ppGlobalWorkSize)); + details::printPtr(os, + *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - printPtr(os, *(params->ppLocalWorkSize)); + details::printPtr(os, + *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -13119,32 +13028,35 @@ operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".phEventWaitList = {"; - for (size_t i = 0; *(params->pphEventWaitList) != NULL && - i < *params->pnumEventsInWaitList; - ++i) { + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphEventWaitList))[i]); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_event_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_get_info_params_t *params) { - os << ".hEvent = "; + os << ".hQueue = "; - printPtr(os, *(params->phEvent)); + details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".propName = "; @@ -13158,449 +13070,488 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_event_get_profiling_info_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_create_params_t *params) { - os << ".hEvent = "; + os << ".hContext = "; - printPtr(os, *(params->phEvent)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".propName = "; + os << ".hDevice = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); + os << ".pProperties = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; - os << ".pPropSizeRet = "; + os << ".phQueue = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->pphQueue)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_event_wait_params_t *params) { - - os << ".numEvents = "; - - os << *(params->pnumEvents); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_retain_params_t *params) { - os << ", "; - os << ".phEventWaitList = {"; - for (size_t i = 0; - *(params->pphEventWaitList) != NULL && i < *params->pnumEvents; ++i) { - if (i != 0) { - os << ", "; - } + os << ".hQueue = "; - printPtr(os, (*(params->pphEventWaitList))[i]); - } - os << "}"; + details::printPtr(os, + *(params->phQueue)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_event_retain_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_release_params_t *params) { - os << ".hEvent = "; + os << ".hQueue = "; - printPtr(os, *(params->phEvent)); + details::printPtr(os, + *(params->phQueue)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_event_release_params_t *params) { - - os << ".hEvent = "; - - printPtr(os, *(params->phEvent)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_get_native_handle_params_t *params) { - return os; -} + os << ".hQueue = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_event_get_native_handle_params_t *params) { + details::printPtr(os, + *(params->phQueue)); - os << ".hEvent = "; + os << ", "; + os << ".pDesc = "; - printPtr(os, *(params->phEvent)); + details::printPtr(os, + *(params->ppDesc)); os << ", "; - os << ".phNativeEvent = "; + os << ".phNativeQueue = "; - printPtr(os, *(params->pphNativeEvent)); + details::printPtr(os, + *(params->pphNativeQueue)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_event_create_with_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_create_with_native_handle_params_t *params) { - os << ".hNativeEvent = "; + os << ".hNativeQueue = "; - printPtr(os, *(params->phNativeEvent)); + details::printPtr(os, + *(params->phNativeQueue)); os << ", "; os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pProperties = "; + os << ".hDevice = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".phEvent = "; + os << ".pProperties = "; - printPtr(os, *(params->pphEvent)); + details::printPtr(os, + *(params->ppProperties)); - return os; -} + os << ", "; + os << ".phQueue = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_event_set_callback_params_t *params) { + details::printPtr(os, + *(params->pphQueue)); - os << ".hEvent = "; + return os; +} - printPtr(os, *(params->phEvent)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_finish_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_finish_params_t *params) { - os << ", "; - os << ".execStatus = "; + os << ".hQueue = "; - os << *(params->pexecStatus); + details::printPtr(os, + *(params->phQueue)); - os << ", "; - os << ".pfnNotify = "; + return os; +} - os << reinterpret_cast(*(params->ppfnNotify)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_queue_flush_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_flush_params_t *params) { - os << ", "; - os << ".pUserData = "; + os << ".hQueue = "; - printPtr(os, *(params->ppUserData)); + details::printPtr(os, + *(params->phQueue)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_create_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_unsampled_image_handle_destroy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *params) { - os << ".hProgram = "; + os << ".hContext = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pKernelName = "; + os << ".hDevice = "; - printPtr(os, *(params->ppKernelName)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".phKernel = "; + os << ".hImage = "; - printPtr(os, *(params->pphKernel)); + details::printPtr(os, + *(params->phImage)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_get_info_params_t *params) { - - os << ".hKernel = "; - - printPtr(os, *(params->phKernel)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_sampled_image_handle_destroy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_sampled_image_handle_destroy_exp_params_t *params) { - os << ", "; - os << ".propName = "; + os << ".hContext = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); + os << ".hDevice = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pPropSizeRet = "; + os << ".hImage = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->phImage)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_get_group_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_allocate_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_image_allocate_exp_params_t *params) { - os << ".hKernel = "; + os << ".hContext = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".propName = "; + os << ".pImageFormat = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->ppImageFormat)); os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); + os << ".pImageDesc = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printPtr(os, + *(params->ppImageDesc)); os << ", "; - os << ".pPropSizeRet = "; + os << ".phImageMem = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->pphImageMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_get_sub_group_info_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_free_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_image_free_exp_params_t *params) { - os << ".hKernel = "; + os << ".hContext = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".propName = "; + os << ".hImageMem = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->phImageMem)); - os << ", "; - os << ".propSize = "; + return os; +} - os << *(params->ppropSize); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_unsampled_image_create_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_unsampled_image_create_exp_params_t *params) { + + os << ".hContext = "; + + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".hDevice = "; + + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pPropSizeRet = "; + os << ".hImageMem = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->phImageMem)); - return os; -} + os << ", "; + os << ".pImageFormat = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_retain_params_t *params) { + details::printPtr(os, + *(params->ppImageFormat)); - os << ".hKernel = "; + os << ", "; + os << ".pImageDesc = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->ppImageDesc)); - return os; -} + os << ", "; + os << ".phMem = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_release_params_t *params) { + details::printPtr(os, + *(params->pphMem)); - os << ".hKernel = "; + os << ", "; + os << ".phImage = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->pphImage)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_kernel_get_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_sampled_image_create_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_sampled_image_create_exp_params_t *params) { - os << ".hKernel = "; + os << ".hContext = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".phNativeKernel = "; + os << ".hDevice = "; - printPtr(os, *(params->pphNativeKernel)); + details::printPtr(os, + *(params->phDevice)); - return os; -} + os << ", "; + os << ".hImageMem = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_create_with_native_handle_params_t - *params) { + details::printPtr(os, + *(params->phImageMem)); - os << ".hNativeKernel = "; + os << ", "; + os << ".pImageFormat = "; - printPtr(os, *(params->phNativeKernel)); + details::printPtr(os, + *(params->ppImageFormat)); os << ", "; - os << ".hContext = "; + os << ".pImageDesc = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->ppImageDesc)); os << ", "; - os << ".hProgram = "; + os << ".hSampler = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phSampler)); os << ", "; - os << ".pProperties = "; + os << ".phMem = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->pphMem)); os << ", "; - os << ".phKernel = "; + os << ".phImage = "; - printPtr(os, *(params->pphKernel)); + details::printPtr(os, + *(params->pphImage)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_set_arg_value_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_copy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_image_copy_exp_params_t *params) { - os << ".hKernel = "; + os << ".hQueue = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phQueue)); os << ", "; - os << ".argIndex = "; + os << ".pDst = "; - os << *(params->pargIndex); + details::printPtr(os, + *(params->ppDst)); os << ", "; - os << ".argSize = "; + os << ".pSrc = "; - os << *(params->pargSize); + details::printPtr(os, + *(params->ppSrc)); os << ", "; - os << ".pProperties = "; + os << ".pImageFormat = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppImageFormat)); os << ", "; - os << ".pArgValue = "; - - printPtr(os, *(params->ppArgValue)); - - return os; -} - -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_set_arg_local_params_t *params) { - - os << ".hKernel = "; + os << ".pImageDesc = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->ppImageDesc)); os << ", "; - os << ".argIndex = "; + os << ".imageCopyFlags = "; - os << *(params->pargIndex); + details::printFlag(os, + *(params->pimageCopyFlags)); os << ", "; - os << ".argSize = "; + os << ".srcOffset = "; - os << *(params->pargSize); + os << *(params->psrcOffset); os << ", "; - os << ".pProperties = "; + os << ".dstOffset = "; - printPtr(os, *(params->ppProperties)); + os << *(params->pdstOffset); - return os; -} + os << ", "; + os << ".copyExtent = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_set_arg_pointer_params_t *params) { + os << *(params->pcopyExtent); - os << ".hKernel = "; + os << ", "; + os << ".hostExtent = "; - printPtr(os, *(params->phKernel)); + os << *(params->phostExtent); os << ", "; - os << ".argIndex = "; + os << ".numEventsInWaitList = "; - os << *(params->pargIndex); + os << *(params->pnumEventsInWaitList); os << ", "; - os << ".pProperties = "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; os << ", "; - os << ".pArgValue = "; + os << ".phEvent = "; - printPtr(os, *(params->ppArgValue)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_set_exec_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_image_get_info_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_image_get_info_exp_params_t *params) { - os << ".hKernel = "; + os << ".hImageMem = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phImageMem)); os << ", "; os << ".propName = "; @@ -13608,473 +13559,493 @@ inline std::ostream &operator<<( os << *(params->ppropName); os << ", "; - os << ".propSize = "; + os << ".pPropValue = "; - os << *(params->ppropSize); + details::printPtr(os, + *(params->ppPropValue)); os << ", "; - os << ".pProperties = "; - - printPtr(os, *(params->ppProperties)); + os << ".pPropSizeRet = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_set_arg_sampler_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_mipmap_get_level_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_mipmap_get_level_exp_params_t *params) { - os << ".hKernel = "; + os << ".hContext = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".argIndex = "; + os << ".hDevice = "; - os << *(params->pargIndex); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pProperties = "; + os << ".hImageMem = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->phImageMem)); os << ", "; - os << ".hArgValue = "; + os << ".mipmapLevel = "; - printPtr(os, *(params->phArgValue)); + os << *(params->pmipmapLevel); - return os; -} + os << ", "; + os << ".phImageMem = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_kernel_set_arg_mem_obj_params_t *params) { + details::printPtr(os, + *(params->pphImageMem)); - os << ".hKernel = "; + return os; +} - printPtr(os, *(params->phKernel)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_mipmap_free_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_mipmap_free_exp_params_t *params) { - os << ", "; - os << ".argIndex = "; + os << ".hContext = "; - os << *(params->pargIndex); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pProperties = "; + os << ".hDevice = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".hArgValue = "; + os << ".hMem = "; - printPtr(os, *(params->phArgValue)); + details::printPtr(os, + *(params->phMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_kernel_set_specialization_constants_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_import_opaque_fd_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_import_opaque_fd_exp_params_t *params) { - os << ".hKernel = "; + os << ".hContext = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".count = "; + os << ".hDevice = "; - os << *(params->pcount); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pSpecConstants = "; - - printPtr(os, *(params->ppSpecConstants)); - - return os; -} + os << ".size = "; -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_kernel_suggest_max_cooperative_group_count_exp_params_t *params) { + os << *(params->psize); - os << ".hKernel = "; + os << ", "; + os << ".pInteropMemDesc = "; - printPtr(os, *(params->phKernel)); + details::printPtr(os, + *(params->ppInteropMemDesc)); os << ", "; - os << ".pGroupCountRet = "; + os << ".phInteropMem = "; - printPtr(os, *(params->ppGroupCountRet)); + details::printPtr(os, + *(params->pphInteropMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_loader_init_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_map_external_array_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_map_external_array_exp_params_t *params) { - os << ".device_flags = "; + os << ".hContext = "; - printFlag(os, *(params->pdevice_flags)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hLoaderConfig = "; + os << ".hDevice = "; - printPtr(os, *(params->phLoaderConfig)); + details::printPtr(os, + *(params->phDevice)); - return os; -} + os << ", "; + os << ".pImageFormat = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_loader_tear_down_params_t *params) { + details::printPtr(os, + *(params->ppImageFormat)); - return os; -} + os << ", "; + os << ".pImageDesc = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_loader_config_create_params_t *params) { + details::printPtr(os, + *(params->ppImageDesc)); - os << ".phLoaderConfig = "; + os << ", "; + os << ".hInteropMem = "; + + details::printPtr(os, + *(params->phInteropMem)); - printPtr(os, *(params->pphLoaderConfig)); + os << ", "; + os << ".phImageMem = "; + + details::printPtr(os, + *(params->pphImageMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_loader_config_retain_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_release_interop_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_release_interop_exp_params_t *params) { - os << ".hLoaderConfig = "; + os << ".hContext = "; - printPtr(os, *(params->phLoaderConfig)); + details::printPtr(os, + *(params->phContext)); - return os; -} + os << ", "; + os << ".hDevice = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_loader_config_release_params_t *params) { + details::printPtr(os, + *(params->phDevice)); - os << ".hLoaderConfig = "; + os << ", "; + os << ".hInteropMem = "; - printPtr(os, *(params->phLoaderConfig)); + details::printPtr(os, + *(params->phInteropMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_loader_config_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_import_external_semaphore_opaque_fd_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_import_external_semaphore_opaque_fd_exp_params_t *params) { - os << ".hLoaderConfig = "; + os << ".hContext = "; - printPtr(os, *(params->phLoaderConfig)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".propName = "; + os << ".hDevice = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".propSize = "; + os << ".pInteropSemaphoreDesc = "; - os << *(params->ppropSize); + details::printPtr(os, + *(params->ppInteropSemaphoreDesc)); os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); - - os << ", "; - os << ".pPropSizeRet = "; - - printPtr(os, *(params->ppPropSizeRet)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_loader_config_enable_layer_params_t - *params) { - - os << ".hLoaderConfig = "; - - printPtr(os, *(params->phLoaderConfig)); - - os << ", "; - os << ".pLayerName = "; + os << ".phInteropSemaphore = "; - printPtr(os, *(params->ppLayerName)); + details::printPtr(os, + *(params->pphInteropSemaphore)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_loader_config_set_code_location_callback_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_destroy_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_destroy_external_semaphore_exp_params_t *params) { - os << ".hLoaderConfig = "; + os << ".hContext = "; - ur_params::serializePtr(os, *(params->phLoaderConfig)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pfnCodeloc = "; + os << ".hDevice = "; - os << reinterpret_cast(*(params->ppfnCodeloc)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pUserData = "; + os << ".hInteropSemaphore = "; - ur_params::serializePtr(os, *(params->ppUserData)); + details::printPtr(os, + *(params->phInteropSemaphore)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_mem_image_create_params_t *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_wait_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_wait_external_semaphore_exp_params_t *params) { - os << ", "; - os << ".flags = "; + os << ".hQueue = "; - printFlag(os, *(params->pflags)); + details::printPtr(os, + *(params->phQueue)); os << ", "; - os << ".pImageFormat = "; + os << ".hSemaphore = "; - printPtr(os, *(params->ppImageFormat)); + details::printPtr(os, + *(params->phSemaphore)); os << ", "; - os << ".pImageDesc = "; + os << ".numEventsInWaitList = "; - printPtr(os, *(params->ppImageDesc)); + os << *(params->pnumEventsInWaitList); os << ", "; - os << ".pHost = "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->ppHost)); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; os << ", "; - os << ".phMem = "; + os << ".phEvent = "; - printPtr(os, *(params->pphMem)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_mem_buffer_create_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_bindless_images_signal_external_semaphore_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_bindless_images_signal_external_semaphore_exp_params_t *params) { - os << ".hContext = "; + os << ".hQueue = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phQueue)); os << ", "; - os << ".flags = "; + os << ".hSemaphore = "; - printFlag(os, *(params->pflags)); + details::printPtr(os, + *(params->phSemaphore)); os << ", "; - os << ".size = "; + os << ".numEventsInWaitList = "; - os << *(params->psize); + os << *(params->pnumEventsInWaitList); os << ", "; - os << ".pProperties = "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; os << ", "; - os << ".phBuffer = "; - - printPtr(os, *(params->pphBuffer)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_mem_retain_params_t *params) { - - os << ".hMem = "; - - printPtr(os, *(params->phMem)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_mem_release_params_t *params) { - - os << ".hMem = "; + os << ".phEvent = "; - printPtr(os, *(params->phMem)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_mem_buffer_partition_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_host_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_host_alloc_params_t *params) { - os << ".hBuffer = "; + os << ".hContext = "; - printPtr(os, *(params->phBuffer)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".flags = "; + os << ".pUSMDesc = "; - printFlag(os, *(params->pflags)); + details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; - os << ".bufferCreateType = "; + os << ".pool = "; - os << *(params->pbufferCreateType); + details::printPtr(os, + *(params->ppool)); os << ", "; - os << ".pRegion = "; + os << ".size = "; - printPtr(os, *(params->ppRegion)); + os << *(params->psize); os << ", "; - os << ".phMem = "; + os << ".ppMem = "; - printPtr(os, *(params->pphMem)); + details::printPtr(os, + *(params->pppMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_mem_get_native_handle_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_device_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_device_alloc_params_t *params) { - os << ".hMem = "; + os << ".hContext = "; - printPtr(os, *(params->phMem)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".phNativeMem = "; - - printPtr(os, *(params->pphNativeMem)); - - return os; -} + os << ".hDevice = "; -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_mem_buffer_create_with_native_handle_params_t *params) { + details::printPtr(os, + *(params->phDevice)); - os << ".hNativeMem = "; + os << ", "; + os << ".pUSMDesc = "; - printPtr(os, *(params->phNativeMem)); + details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; - os << ".hContext = "; + os << ".pool = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->ppool)); os << ", "; - os << ".pProperties = "; + os << ".size = "; - printPtr(os, *(params->ppProperties)); + os << *(params->psize); os << ", "; - os << ".phMem = "; + os << ".ppMem = "; - printPtr(os, *(params->pphMem)); + details::printPtr(os, + *(params->pppMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_mem_image_create_with_native_handle_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_shared_alloc_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_shared_alloc_params_t *params) { - os << ".hNativeMem = "; + os << ".hContext = "; - printPtr(os, *(params->phNativeMem)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".hContext = "; + os << ".hDevice = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".pImageFormat = "; + os << ".pUSMDesc = "; - printPtr(os, *(params->ppImageFormat)); + details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; - os << ".pImageDesc = "; + os << ".pool = "; - printPtr(os, *(params->ppImageDesc)); + details::printPtr(os, + *(params->ppool)); os << ", "; - os << ".pProperties = "; + os << ".size = "; - printPtr(os, *(params->ppProperties)); + os << *(params->psize); os << ", "; - os << ".phMem = "; + os << ".ppMem = "; - printPtr(os, *(params->pphMem)); + details::printPtr(os, + *(params->pppMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_mem_get_info_params_t *params) { - - os << ".hMemory = "; - - printPtr(os, *(params->phMemory)); - - os << ", "; - os << ".propName = "; - - os << *(params->ppropName); - - os << ", "; - os << ".propSize = "; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_free_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_free_params_t *params) { - os << *(params->ppropSize); + os << ".hContext = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pPropSizeRet = "; + os << ".pMem = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppMem)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_mem_image_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_get_mem_alloc_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_get_mem_alloc_info_params_t *params) { - os << ".hMemory = "; + os << ".hContext = "; + + details::printPtr(os, + *(params->phContext)); + + os << ", "; + os << ".pMem = "; - printPtr(os, *(params->phMemory)); + details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".propName = "; @@ -14088,122 +14059,81 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_physical_mem_create_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_create_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_create_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); - - os << ", "; - os << ".hDevice = "; - - printPtr(os, *(params->phDevice)); - - os << ", "; - os << ".size = "; - - os << *(params->psize); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pProperties = "; + os << ".pPoolDesc = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppPoolDesc)); os << ", "; - os << ".phPhysicalMem = "; - - printPtr(os, *(params->pphPhysicalMem)); - - return os; -} - -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_physical_mem_retain_params_t *params) { - - os << ".hPhysicalMem = "; + os << ".ppPool = "; - printPtr(os, *(params->phPhysicalMem)); + details::printPtr(os, + *(params->pppPool)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_physical_mem_release_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_retain_params_t *params) { - os << ".hPhysicalMem = "; + os << ".pPool = "; - printPtr(os, *(params->phPhysicalMem)); + details::printPtr(os, + *(params->ppPool)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_platform_get_params_t *params) { - - os << ".phAdapters = {"; - for (size_t i = 0; - *(params->pphAdapters) != NULL && i < *params->pNumAdapters; ++i) { - if (i != 0) { - os << ", "; - } - - printPtr(os, (*(params->pphAdapters))[i]); - } - os << "}"; - - os << ", "; - os << ".NumAdapters = "; - - os << *(params->pNumAdapters); - - os << ", "; - os << ".NumEntries = "; - - os << *(params->pNumEntries); - - os << ", "; - os << ".phPlatforms = {"; - for (size_t i = 0; - *(params->pphPlatforms) != NULL && i < *params->pNumEntries; ++i) { - if (i != 0) { - os << ", "; - } - - printPtr(os, (*(params->pphPlatforms))[i]); - } - os << "}"; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_release_params_t *params) { - os << ", "; - os << ".pNumPlatforms = "; + os << ".pPool = "; - printPtr(os, *(params->ppNumPlatforms)); + details::printPtr(os, + *(params->ppPool)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_platform_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pool_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_get_info_params_t *params) { - os << ".hPlatform = "; + os << ".hPool = "; - printPtr(os, *(params->phPlatform)); + details::printPtr(os, + *(params->phPool)); os << ", "; os << ".propName = "; @@ -14217,1067 +14147,1007 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_platform_get_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_pitched_alloc_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pitched_alloc_exp_params_t *params) { - os << ".hPlatform = "; + os << ".hContext = "; - printPtr(os, *(params->phPlatform)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".phNativePlatform = "; + os << ".hDevice = "; - printPtr(os, *(params->pphNativePlatform)); + details::printPtr(os, + *(params->phDevice)); - return os; -} + os << ", "; + os << ".pUSMDesc = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_platform_create_with_native_handle_params_t - *params) { + details::printPtr(os, + *(params->ppUSMDesc)); - os << ".hNativePlatform = "; + os << ", "; + os << ".pool = "; - printPtr(os, *(params->phNativePlatform)); + details::printPtr(os, + *(params->ppool)); os << ", "; - os << ".pProperties = "; + os << ".widthInBytes = "; - printPtr(os, *(params->ppProperties)); + os << *(params->pwidthInBytes); os << ", "; - os << ".phPlatform = "; + os << ".height = "; - printPtr(os, *(params->pphPlatform)); + os << *(params->pheight); - return os; -} + os << ", "; + os << ".elementSizeBytes = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_platform_get_api_version_params_t - *params) { + os << *(params->pelementSizeBytes); - os << ".hPlatform = "; + os << ", "; + os << ".ppMem = "; - printPtr(os, *(params->phPlatform)); + details::printPtr(os, + *(params->pppMem)); os << ", "; - os << ".pVersion = "; + os << ".pResultPitch = "; - printPtr(os, *(params->ppVersion)); + details::printPtr(os, + *(params->ppResultPitch)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_platform_get_backend_option_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_import_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_import_exp_params_t *params) { - os << ".hPlatform = "; + os << ".hContext = "; - printPtr(os, *(params->phPlatform)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".pFrontendOption = "; + os << ".pMem = "; - printPtr(os, *(params->ppFrontendOption)); + details::printPtr(os, + *(params->ppMem)); os << ", "; - os << ".ppPlatformOption = "; + os << ".size = "; - printPtr(os, *(params->pppPlatformOption)); + os << *(params->psize); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_program_create_with_il_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_release_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_release_exp_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); - - os << ", "; - os << ".pIL = "; - - printPtr(os, *(params->ppIL)); + details::printPtr(os, + *(params->phContext)); os << ", "; - os << ".length = "; - - os << *(params->plength); - - os << ", "; - os << ".pProperties = "; - - printPtr(os, *(params->ppProperties)); - - os << ", "; - os << ".phProgram = "; + os << ".pMem = "; - printPtr(os, *(params->pphProgram)); + details::printPtr(os, + *(params->ppMem)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_create_with_binary_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_create_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_create_exp_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; - os << ".size = "; + os << ".pCommandBufferDesc = "; - os << *(params->psize); + details::printPtr(os, + *(params->ppCommandBufferDesc)); os << ", "; - os << ".pBinary = "; + os << ".phCommandBuffer = "; - printPtr(os, *(params->ppBinary)); + details::printPtr(os, + *(params->pphCommandBuffer)); - os << ", "; - os << ".pProperties = "; + return os; +} - printPtr(os, *(params->ppProperties)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_retain_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_retain_exp_params_t *params) { - os << ", "; - os << ".phProgram = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->pphProgram)); + details::printPtr(os, + *(params->phCommandBuffer)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_build_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_release_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_release_exp_params_t *params) { - os << ".hContext = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phCommandBuffer)); - os << ", "; - os << ".hProgram = "; + return os; +} - printPtr(os, *(params->phProgram)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_finalize_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_finalize_exp_params_t *params) { - os << ", "; - os << ".pOptions = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->ppOptions)); + details::printPtr(os, + *(params->phCommandBuffer)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_compile_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_kernel_launch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_kernel_launch_exp_params_t *params) { - os << ".hContext = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".hProgram = "; + os << ".hKernel = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phKernel)); os << ", "; - os << ".pOptions = "; + os << ".workDim = "; - printPtr(os, *(params->ppOptions)); + os << *(params->pworkDim); - return os; -} + os << ", "; + os << ".pGlobalWorkOffset = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_link_params_t *params) { + details::printPtr(os, + *(params->ppGlobalWorkOffset)); - os << ".hContext = "; + os << ", "; + os << ".pGlobalWorkSize = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->ppGlobalWorkSize)); os << ", "; - os << ".count = "; + os << ".pLocalWorkSize = "; - os << *(params->pcount); + details::printPtr(os, + *(params->ppLocalWorkSize)); os << ", "; - os << ".phPrograms = {"; - for (size_t i = 0; *(params->pphPrograms) != NULL && i < *params->pcount; - ++i) { - if (i != 0) { - os << ", "; - } + os << ".numSyncPointsInWaitList = "; - printPtr(os, (*(params->pphPrograms))[i]); - } - os << "}"; + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".pOptions = "; + os << ".pSyncPointWaitList = "; - printPtr(os, *(params->ppOptions)); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".phProgram = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->pphProgram)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_retain_params_t *params) { - - os << ".hProgram = "; - - printPtr(os, *(params->phProgram)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_usm_memcpy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_usm_memcpy_exp_params_t *params) { - return os; -} + os << ".hCommandBuffer = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_release_params_t *params) { + details::printPtr(os, + *(params->phCommandBuffer)); - os << ".hProgram = "; + os << ", "; + os << ".pDst = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->ppDst)); - return os; -} + os << ", "; + os << ".pSrc = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_program_get_function_pointer_params_t - *params) { + details::printPtr(os, + *(params->ppSrc)); - os << ".hDevice = "; + os << ", "; + os << ".size = "; - printPtr(os, *(params->phDevice)); + os << *(params->psize); os << ", "; - os << ".hProgram = "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->phProgram)); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".pFunctionName = "; + os << ".pSyncPointWaitList = "; - printPtr(os, *(params->ppFunctionName)); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".ppFunctionPointer = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->pppFunctionPointer)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_usm_fill_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_usm_fill_exp_params_t *params) { - os << ".hProgram = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".propName = "; + os << ".pMemory = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->ppMemory)); os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); + os << ".pPattern = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printPtr(os, + *(params->ppPattern)); os << ", "; - os << ".pPropSizeRet = "; + os << ".patternSize = "; - printPtr(os, *(params->ppPropSizeRet)); + os << *(params->ppatternSize); - return os; -} + os << ", "; + os << ".size = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_program_get_build_info_params_t *params) { + os << *(params->psize); - os << ".hProgram = "; + os << ", "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->phProgram)); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".hDevice = "; + os << ".pSyncPointWaitList = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".propName = "; + os << ".pSyncPoint = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->ppSyncPoint)); - os << ", "; - os << ".propSize = "; + return os; +} - os << *(params->ppropSize); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_copy_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_copy_exp_params_t *params) { - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".hCommandBuffer = "; + + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".pPropSizeRet = "; + os << ".hSrcMem = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->phSrcMem)); - return os; -} + os << ", "; + os << ".hDstMem = "; -inline std::ostream & -operator<<(std::ostream &os, [[maybe_unused]] const struct - ur_program_set_specialization_constants_params_t *params) { + details::printPtr(os, + *(params->phDstMem)); - os << ".hProgram = "; + os << ", "; + os << ".srcOffset = "; - printPtr(os, *(params->phProgram)); + os << *(params->psrcOffset); os << ", "; - os << ".count = "; + os << ".dstOffset = "; - os << *(params->pcount); + os << *(params->pdstOffset); os << ", "; - os << ".pSpecConstants = {"; - for (size_t i = 0; - *(params->ppSpecConstants) != NULL && i < *params->pcount; ++i) { - if (i != 0) { - os << ", "; - } + os << ".size = "; - os << (*(params->ppSpecConstants))[i]; - } - os << "}"; + os << *(params->psize); - return os; -} + os << ", "; + os << ".numSyncPointsInWaitList = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_program_get_native_handle_params_t - *params) { + os << *(params->pnumSyncPointsInWaitList); - os << ".hProgram = "; + os << ", "; + os << ".pSyncPointWaitList = "; - printPtr(os, *(params->phProgram)); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".phNativeProgram = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->pphNativeProgram)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_program_create_with_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_write_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_write_exp_params_t *params) { - os << ".hNativeProgram = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phNativeProgram)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".hContext = "; + os << ".hBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; - os << ".pProperties = "; + os << ".offset = "; - printPtr(os, *(params->ppProperties)); + os << *(params->poffset); os << ", "; - os << ".phProgram = "; - - printPtr(os, *(params->pphProgram)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_get_info_params_t *params) { - - os << ".hQueue = "; + os << ".size = "; - printPtr(os, *(params->phQueue)); + os << *(params->psize); os << ", "; - os << ".propName = "; + os << ".pSrc = "; - os << *(params->ppropName); + details::printPtr(os, + *(params->ppSrc)); os << ", "; - os << ".propSize = "; + os << ".numSyncPointsInWaitList = "; - os << *(params->ppropSize); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".pSyncPointWaitList = "; + + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".pPropSizeRet = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_create_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_read_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_read_exp_params_t *params) { - os << ".hContext = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".hDevice = "; + os << ".hBuffer = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; - os << ".pProperties = "; + os << ".offset = "; - printPtr(os, *(params->ppProperties)); + os << *(params->poffset); os << ", "; - os << ".phQueue = "; + os << ".size = "; - printPtr(os, *(params->pphQueue)); + os << *(params->psize); - return os; -} + os << ", "; + os << ".pDst = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_retain_params_t *params) { + details::printPtr(os, + *(params->ppDst)); - os << ".hQueue = "; + os << ", "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->phQueue)); + os << *(params->pnumSyncPointsInWaitList); - return os; -} + os << ", "; + os << ".pSyncPointWaitList = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_release_params_t *params) { + details::printPtr(os, + *(params->ppSyncPointWaitList)); - os << ".hQueue = "; + os << ", "; + os << ".pSyncPoint = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_queue_get_native_handle_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *params) { - os << ".hQueue = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".pDesc = "; + os << ".hSrcMem = "; - printPtr(os, *(params->ppDesc)); + details::printPtr(os, + *(params->phSrcMem)); os << ", "; - os << ".phNativeQueue = "; + os << ".hDstMem = "; - printPtr(os, *(params->pphNativeQueue)); + details::printPtr(os, + *(params->phDstMem)); - return os; -} + os << ", "; + os << ".srcOrigin = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_queue_create_with_native_handle_params_t - *params) { + os << *(params->psrcOrigin); - os << ".hNativeQueue = "; + os << ", "; + os << ".dstOrigin = "; - printPtr(os, *(params->phNativeQueue)); + os << *(params->pdstOrigin); os << ", "; - os << ".hContext = "; + os << ".region = "; - printPtr(os, *(params->phContext)); + os << *(params->pregion); os << ", "; - os << ".hDevice = "; + os << ".srcRowPitch = "; - printPtr(os, *(params->phDevice)); + os << *(params->psrcRowPitch); os << ", "; - os << ".pProperties = "; + os << ".srcSlicePitch = "; - printPtr(os, *(params->ppProperties)); + os << *(params->psrcSlicePitch); os << ", "; - os << ".phQueue = "; + os << ".dstRowPitch = "; - printPtr(os, *(params->pphQueue)); + os << *(params->pdstRowPitch); - return os; -} + os << ", "; + os << ".dstSlicePitch = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_finish_params_t *params) { + os << *(params->pdstSlicePitch); - os << ".hQueue = "; + os << ", "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->phQueue)); + os << *(params->pnumSyncPointsInWaitList); - return os; -} + os << ", "; + os << ".pSyncPointWaitList = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_queue_flush_params_t *params) { + details::printPtr(os, + *(params->ppSyncPointWaitList)); - os << ".hQueue = "; + os << ", "; + os << ".pSyncPoint = "; - printPtr(os, *(params->phQueue)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_create_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_write_rect_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *params) { - os << ".hContext = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".pDesc = "; + os << ".hBuffer = "; - printPtr(os, *(params->ppDesc)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; - os << ".phSampler = "; + os << ".bufferOffset = "; - printPtr(os, *(params->pphSampler)); + os << *(params->pbufferOffset); - return os; -} + os << ", "; + os << ".hostOffset = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_retain_params_t *params) { + os << *(params->phostOffset); - os << ".hSampler = "; + os << ", "; + os << ".region = "; - printPtr(os, *(params->phSampler)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_release_params_t *params) { - - os << ".hSampler = "; - - printPtr(os, *(params->phSampler)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_get_info_params_t *params) { - - os << ".hSampler = "; - - printPtr(os, *(params->phSampler)); + os << *(params->pregion); os << ", "; - os << ".propName = "; + os << ".bufferRowPitch = "; - os << *(params->ppropName); + os << *(params->pbufferRowPitch); os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); + os << ".bufferSlicePitch = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << *(params->pbufferSlicePitch); os << ", "; - os << ".pPropSizeRet = "; - - printPtr(os, *(params->ppPropSizeRet)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_sampler_get_native_handle_params_t - *params) { - - os << ".hSampler = "; + os << ".hostRowPitch = "; - printPtr(os, *(params->phSampler)); + os << *(params->phostRowPitch); os << ", "; - os << ".phNativeSampler = "; - - printPtr(os, *(params->pphNativeSampler)); - - return os; -} + os << ".hostSlicePitch = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_sampler_create_with_native_handle_params_t - *params) { + os << *(params->phostSlicePitch); - os << ".hNativeSampler = "; + os << ", "; + os << ".pSrc = "; - printPtr(os, *(params->phNativeSampler)); + details::printPtr(os, + *(params->ppSrc)); os << ", "; - os << ".hContext = "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->phContext)); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".pProperties = "; + os << ".pSyncPointWaitList = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".phSampler = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->pphSampler)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_host_alloc_params_t *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); - - os << ", "; - os << ".pUSMDesc = "; - - printPtr(os, *(params->ppUSMDesc)); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_read_rect_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *params) { - os << ", "; - os << ".pool = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->ppool)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".size = "; + os << ".hBuffer = "; - os << *(params->psize); + details::printPtr(os, + *(params->phBuffer)); os << ", "; - os << ".ppMem = "; - - printPtr(os, *(params->pppMem)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_device_alloc_params_t *params) { - - os << ".hContext = "; + os << ".bufferOffset = "; - printPtr(os, *(params->phContext)); + os << *(params->pbufferOffset); os << ", "; - os << ".hDevice = "; + os << ".hostOffset = "; - printPtr(os, *(params->phDevice)); + os << *(params->phostOffset); os << ", "; - os << ".pUSMDesc = "; + os << ".region = "; - printPtr(os, *(params->ppUSMDesc)); + os << *(params->pregion); os << ", "; - os << ".pool = "; + os << ".bufferRowPitch = "; - printPtr(os, *(params->ppool)); + os << *(params->pbufferRowPitch); os << ", "; - os << ".size = "; + os << ".bufferSlicePitch = "; - os << *(params->psize); + os << *(params->pbufferSlicePitch); os << ", "; - os << ".ppMem = "; - - printPtr(os, *(params->pppMem)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_shared_alloc_params_t *params) { - - os << ".hContext = "; + os << ".hostRowPitch = "; - printPtr(os, *(params->phContext)); + os << *(params->phostRowPitch); os << ", "; - os << ".hDevice = "; + os << ".hostSlicePitch = "; - printPtr(os, *(params->phDevice)); + os << *(params->phostSlicePitch); os << ", "; - os << ".pUSMDesc = "; + os << ".pDst = "; - printPtr(os, *(params->ppUSMDesc)); + details::printPtr(os, + *(params->ppDst)); os << ", "; - os << ".pool = "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->ppool)); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".size = "; + os << ".pSyncPointWaitList = "; - os << *(params->psize); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".ppMem = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->pppMem)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_free_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_mem_buffer_fill_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t *params) { - os << ".hContext = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".pMem = "; - - printPtr(os, *(params->ppMem)); - - return os; -} - -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_get_mem_alloc_info_params_t *params) { - - os << ".hContext = "; + os << ".hBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phBuffer)); os << ", "; - os << ".pMem = "; + os << ".pPattern = "; - printPtr(os, *(params->ppMem)); + details::printPtr(os, + *(params->ppPattern)); os << ", "; - os << ".propName = "; + os << ".patternSize = "; - os << *(params->ppropName); + os << *(params->ppatternSize); os << ", "; - os << ".propSize = "; - - os << *(params->ppropSize); + os << ".offset = "; - os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << *(params->poffset); os << ", "; - os << ".pPropSizeRet = "; - - printPtr(os, *(params->ppPropSizeRet)); - - return os; -} - -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_create_params_t *params) { - - os << ".hContext = "; + os << ".size = "; - printPtr(os, *(params->phContext)); + os << *(params->psize); os << ", "; - os << ".pPoolDesc = "; + os << ".numSyncPointsInWaitList = "; - printPtr(os, *(params->ppPoolDesc)); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".ppPool = "; - - printPtr(os, *(params->pppPool)); - - return os; -} + os << ".pSyncPointWaitList = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_retain_params_t *params) { + details::printPtr(os, + *(params->ppSyncPointWaitList)); - os << ".pPool = "; + os << ", "; + os << ".pSyncPoint = "; - printPtr(os, *(params->ppPool)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_release_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_usm_prefetch_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_usm_prefetch_exp_params_t *params) { - os << ".pPool = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->ppPool)); + details::printPtr(os, + *(params->phCommandBuffer)); - return os; -} + os << ", "; + os << ".pMemory = "; -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_pool_get_info_params_t *params) { + details::printPtr(os, + *(params->ppMemory)); - os << ".hPool = "; + os << ", "; + os << ".size = "; - printPtr(os, *(params->phPool)); + os << *(params->psize); os << ", "; - os << ".propName = "; + os << ".flags = "; - os << *(params->ppropName); + details::printFlag(os, + *(params->pflags)); os << ", "; - os << ".propSize = "; + os << ".numSyncPointsInWaitList = "; - os << *(params->ppropSize); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + os << ".pSyncPointWaitList = "; + + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".pPropSizeRet = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_pitched_alloc_exp_params_t *params) { - - os << ".hContext = "; - - printPtr(os, *(params->phContext)); - - os << ", "; - os << ".hDevice = "; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_append_usm_advise_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_append_usm_advise_exp_params_t *params) { - printPtr(os, *(params->phDevice)); - - os << ", "; - os << ".pUSMDesc = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->ppUSMDesc)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".pool = "; + os << ".pMemory = "; - printPtr(os, *(params->ppool)); + details::printPtr(os, + *(params->ppMemory)); os << ", "; - os << ".widthInBytes = "; + os << ".size = "; - os << *(params->pwidthInBytes); + os << *(params->psize); os << ", "; - os << ".height = "; + os << ".advice = "; - os << *(params->pheight); + details::printFlag(os, + *(params->padvice)); os << ", "; - os << ".elementSizeBytes = "; + os << ".numSyncPointsInWaitList = "; - os << *(params->pelementSizeBytes); + os << *(params->pnumSyncPointsInWaitList); os << ", "; - os << ".ppMem = "; + os << ".pSyncPointWaitList = "; - printPtr(os, *(params->pppMem)); + details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; - os << ".pResultPitch = "; + os << ".pSyncPoint = "; - printPtr(os, *(params->ppResultPitch)); + details::printPtr(os, + *(params->ppSyncPoint)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_import_exp_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_command_buffer_enqueue_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_command_buffer_enqueue_exp_params_t *params) { - os << ".hContext = "; + os << ".hCommandBuffer = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; - os << ".pMem = "; + os << ".hQueue = "; - printPtr(os, *(params->ppMem)); + details::printPtr(os, + *(params->phQueue)); os << ", "; - os << ".size = "; - - os << *(params->psize); - - return os; -} + os << ".numEventsInWaitList = "; -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_usm_release_exp_params_t *params) { + os << *(params->pnumEventsInWaitList); - os << ".hContext = "; + os << ", "; + os << ".phEventWaitList = {"; + for (size_t i = 0; *(params->pphEventWaitList) != NULL && i < *params->pnumEventsInWaitList; ++i) { + if (i != 0) { + os << ", "; + } - printPtr(os, *(params->phContext)); + details::printPtr(os, + (*(params->pphEventWaitList))[i]); + } + os << "}"; os << ", "; - os << ".pMem = "; + os << ".phEvent = "; - printPtr(os, *(params->ppMem)); + details::printPtr(os, + *(params->pphEvent)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_p2p_enable_peer_access_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_p2p_enable_peer_access_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_p2p_enable_peer_access_exp_params_t *params) { os << ".commandDevice = "; - printPtr(os, *(params->pcommandDevice)); + details::printPtr(os, + *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - printPtr(os, *(params->ppeerDevice)); + details::printPtr(os, + *(params->ppeerDevice)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_p2p_disable_peer_access_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_p2p_disable_peer_access_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_p2p_disable_peer_access_exp_params_t *params) { os << ".commandDevice = "; - printPtr(os, *(params->pcommandDevice)); + details::printPtr(os, + *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - printPtr(os, *(params->ppeerDevice)); + details::printPtr(os, + *(params->ppeerDevice)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_usm_p2p_peer_access_get_info_exp_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_usm_p2p_peer_access_get_info_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_p2p_peer_access_get_info_exp_params_t *params) { os << ".commandDevice = "; - printPtr(os, *(params->pcommandDevice)); + details::printPtr(os, + *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - printPtr(os, *(params->ppeerDevice)); + details::printPtr(os, + *(params->ppeerDevice)); os << ", "; os << ".propName = "; @@ -15291,30 +15161,62 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_granularity_get_info_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_init_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_init_params_t *params) { + + os << ".device_flags = "; + + details::printFlag(os, + *(params->pdevice_flags)); + + os << ", "; + os << ".hLoaderConfig = "; + + details::printPtr(os, + *(params->phLoaderConfig)); + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_loader_tear_down_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_loader_tear_down_params_t *params) { + + return os; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_granularity_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_granularity_get_info_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15328,29 +15230,33 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_reserve_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_reserve_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_reserve_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - printPtr(os, *(params->ppStart)); + details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15360,23 +15266,28 @@ inline std::ostream &operator<<( os << ", "; os << ".ppStart = "; - printPtr(os, *(params->pppStart)); + details::printPtr(os, + *(params->pppStart)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_free_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_free_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_free_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - printPtr(os, *(params->ppStart)); + details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15386,18 +15297,22 @@ operator<<(std::ostream &os, return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_map_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_map_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_map_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - printPtr(os, *(params->ppStart)); + details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15407,7 +15322,8 @@ operator<<(std::ostream &os, os << ", "; os << ".hPhysicalMem = "; - printPtr(os, *(params->phPhysicalMem)); + details::printPtr(os, + *(params->phPhysicalMem)); os << ", "; os << ".offset = "; @@ -15417,23 +15333,28 @@ operator<<(std::ostream &os, os << ", "; os << ".flags = "; - printFlag(os, *(params->pflags)); + details::printFlag(os, + *(params->pflags)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_unmap_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_unmap_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_unmap_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - printPtr(os, *(params->ppStart)); + details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15443,18 +15364,22 @@ inline std::ostream &operator<<( return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_set_access_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_set_access_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_set_access_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - printPtr(os, *(params->ppStart)); + details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15464,23 +15389,28 @@ inline std::ostream &operator<<( os << ", "; os << ".flags = "; - printFlag(os, *(params->pflags)); + details::printFlag(os, + *(params->pflags)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_virtual_mem_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_virtual_mem_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_virtual_mem_get_info_params_t *params) { os << ".hContext = "; - printPtr(os, *(params->phContext)); + details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - printPtr(os, *(params->ppStart)); + details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15499,24 +15429,27 @@ inline std::ostream &operator<<( os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_get_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_get_params_t *params) { os << ".hPlatform = "; - printPtr(os, *(params->phPlatform)); + details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".DeviceType = "; @@ -15530,31 +15463,35 @@ operator<<(std::ostream &os, os << ", "; os << ".phDevices = {"; - for (size_t i = 0; - *(params->pphDevices) != NULL && i < *params->pNumEntries; ++i) { + for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pNumEntries; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphDevices))[i]); + details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevices = "; - printPtr(os, *(params->ppNumDevices)); + details::printPtr(os, + *(params->ppNumDevices)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_get_info_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_info_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_get_info_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15568,51 +15505,61 @@ operator<<(std::ostream &os, os << ", "; os << ".pPropValue = "; - printTagged(os, *(params->ppPropValue), *(params->ppropName), - *(params->ppropSize)); + details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - printPtr(os, *(params->ppPropSizeRet)); + details::printPtr(os, + *(params->ppPropSizeRet)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_retain_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_retain_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_retain_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_release_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_release_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_release_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_partition_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_partition_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pProperties = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".NumDevices = "; @@ -15621,36 +15568,41 @@ operator<<(std::ostream &os, os << ", "; os << ".phSubDevices = {"; - for (size_t i = 0; - *(params->pphSubDevices) != NULL && i < *params->pNumDevices; ++i) { + for (size_t i = 0; *(params->pphSubDevices) != NULL && i < *params->pNumDevices; ++i) { if (i != 0) { os << ", "; } - printPtr(os, (*(params->pphSubDevices))[i]); + details::printPtr(os, + (*(params->pphSubDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevicesRet = "; - printPtr(os, *(params->ppNumDevicesRet)); + details::printPtr(os, + *(params->ppNumDevicesRet)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_device_select_binary_params_t *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_select_binary_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_select_binary_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pBinaries = "; - printPtr(os, *(params->ppBinaries)); + details::printPtr(os, + *(params->ppBinaries)); os << ", "; os << ".NumBinaries = "; @@ -15660,78 +15612,95 @@ inline std::ostream &operator<<( os << ", "; os << ".pSelectedBinary = "; - printPtr(os, *(params->ppSelectedBinary)); + details::printPtr(os, + *(params->ppSelectedBinary)); return os; } -inline std::ostream & -operator<<(std::ostream &os, - [[maybe_unused]] const struct ur_device_get_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_get_native_handle_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".phNativeDevice = "; - printPtr(os, *(params->pphNativeDevice)); + details::printPtr(os, + *(params->pphNativeDevice)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_device_create_with_native_handle_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_create_with_native_handle_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_create_with_native_handle_params_t *params) { os << ".hNativeDevice = "; - printPtr(os, *(params->phNativeDevice)); + details::printPtr(os, + *(params->phNativeDevice)); os << ", "; os << ".hPlatform = "; - printPtr(os, *(params->phPlatform)); + details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".pProperties = "; - printPtr(os, *(params->ppProperties)); + details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phDevice = "; - printPtr(os, *(params->pphDevice)); + details::printPtr(os, + *(params->pphDevice)); return os; } -inline std::ostream &operator<<( - std::ostream &os, - [[maybe_unused]] const struct ur_device_get_global_timestamps_params_t - *params) { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_device_get_global_timestamps_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_get_global_timestamps_params_t *params) { os << ".hDevice = "; - printPtr(os, *(params->phDevice)); + details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pDeviceTimestamp = "; - printPtr(os, *(params->ppDeviceTimestamp)); + details::printPtr(os, + *(params->ppDeviceTimestamp)); os << ", "; os << ".pHostTimestamp = "; - printPtr(os, *(params->ppHostTimestamp)); + details::printPtr(os, + *(params->ppHostTimestamp)); return os; } -template inline void printPtr(std::ostream &os, const T *ptr) { +namespace details { +/////////////////////////////////////////////////////////////////////////////// +// @brief Print pointer value +template +inline ur_result_t printPtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; } else if constexpr (std::is_pointer_v) { @@ -15749,162 +15718,63 @@ template inline void printPtr(std::ostream &os, const T *ptr) { os << *ptr; os << ")"; } + + return UR_RESULT_SUCCESS; } +} // namespace details +} // namespace print -inline int printFunctionParams(std::ostream &os, uint32_t function, - const void *params) { - switch ((enum ur_function_t)function) { - case UR_FUNCTION_ADAPTER_GET: { - os << (const struct ur_adapter_get_params_t *)params; - } break; - case UR_FUNCTION_ADAPTER_RELEASE: { - os << (const struct ur_adapter_release_params_t *)params; - } break; - case UR_FUNCTION_ADAPTER_RETAIN: { - os << (const struct ur_adapter_retain_params_t *)params; - } break; - case UR_FUNCTION_ADAPTER_GET_LAST_ERROR: { - os << (const struct ur_adapter_get_last_error_params_t *)params; - } break; - case UR_FUNCTION_ADAPTER_GET_INFO: { - os << (const struct ur_adapter_get_info_params_t *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP: { - os << (const struct - ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP: { - os << (const struct - ur_bindless_images_sampled_image_handle_destroy_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP: { - os << (const struct ur_bindless_images_image_allocate_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP: { - os << (const struct ur_bindless_images_image_free_exp_params_t *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP: { - os << (const struct - ur_bindless_images_unsampled_image_create_exp_params_t *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP: { - os << (const struct ur_bindless_images_sampled_image_create_exp_params_t - *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP: { - os << (const struct ur_bindless_images_image_copy_exp_params_t *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP: { - os << (const struct ur_bindless_images_image_get_info_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP: { - os << (const struct ur_bindless_images_mipmap_get_level_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP: { - os << (const struct ur_bindless_images_mipmap_free_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP: { - os << (const struct ur_bindless_images_import_opaque_fd_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP: { - os << (const struct ur_bindless_images_map_external_array_exp_params_t - *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP: { - os << (const struct ur_bindless_images_release_interop_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXP: { - os << (const struct - ur_bindless_images_import_external_semaphore_opaque_fd_exp_params_t - *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP: { - os << (const struct - ur_bindless_images_destroy_external_semaphore_exp_params_t *) - params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP: { - os << (const struct - ur_bindless_images_wait_external_semaphore_exp_params_t *)params; - } break; - case UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP: { - os << (const struct - ur_bindless_images_signal_external_semaphore_exp_params_t *) - params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP: { - os << (const struct ur_command_buffer_create_exp_params_t *)params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP: { - os << (const struct ur_command_buffer_retain_exp_params_t *)params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP: { - os << (const struct ur_command_buffer_release_exp_params_t *)params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP: { - os << (const struct ur_command_buffer_finalize_exp_params_t *)params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP: { - os << (const struct ur_command_buffer_append_kernel_launch_exp_params_t - *)params; - } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: { - os << (const struct ur_command_buffer_append_usm_memcpy_exp_params_t *) - params; +namespace extras { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print function parameters +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_ENUMERATION +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - `NULL == params` +UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { + using namespace print; + + if (!params) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + switch (function) { + case UR_FUNCTION_LOADER_CONFIG_CREATE: { + os << (const struct ur_loader_config_create_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: { - os << (const struct ur_command_buffer_append_usm_fill_exp_params_t *) - params; + case UR_FUNCTION_LOADER_CONFIG_RETAIN: { + os << (const struct ur_loader_config_retain_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_copy_exp_params_t *)params; + case UR_FUNCTION_LOADER_CONFIG_RELEASE: { + os << (const struct ur_loader_config_release_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_write_exp_params_t *)params; + case UR_FUNCTION_LOADER_CONFIG_GET_INFO: { + os << (const struct ur_loader_config_get_info_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_read_exp_params_t *)params; + case UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER: { + os << (const struct ur_loader_config_enable_layer_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *) - params; + case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: { + os << (const struct ur_loader_config_set_code_location_callback_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *) - params; + case UR_FUNCTION_PLATFORM_GET: { + os << (const struct ur_platform_get_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *) - params; + case UR_FUNCTION_PLATFORM_GET_INFO: { + os << (const struct ur_platform_get_info_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: { - os << (const struct - ur_command_buffer_append_mem_buffer_fill_exp_params_t *)params; + case UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE: { + os << (const struct ur_platform_get_native_handle_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: { - os << (const struct ur_command_buffer_append_usm_prefetch_exp_params_t - *)params; + case UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_platform_create_with_native_handle_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: { - os << (const struct ur_command_buffer_append_usm_advise_exp_params_t *) - params; + case UR_FUNCTION_PLATFORM_GET_API_VERSION: { + os << (const struct ur_platform_get_api_version_params_t *)params; } break; - case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: { - os << (const struct ur_command_buffer_enqueue_exp_params_t *)params; + case UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION: { + os << (const struct ur_platform_get_backend_option_params_t *)params; } break; case UR_FUNCTION_CONTEXT_CREATE: { os << (const struct ur_context_create_params_t *)params; @@ -15922,94 +15792,11 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_context_get_native_handle_params_t *)params; } break; case UR_FUNCTION_CONTEXT_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_context_create_with_native_handle_params_t *) - params; + os << (const struct ur_context_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_CONTEXT_SET_EXTENDED_DELETER: { os << (const struct ur_context_set_extended_deleter_params_t *)params; } break; - case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH: { - os << (const struct ur_enqueue_kernel_launch_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_EVENTS_WAIT: { - os << (const struct ur_enqueue_events_wait_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER: { - os << (const struct ur_enqueue_events_wait_with_barrier_params_t *) - params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ: { - os << (const struct ur_enqueue_mem_buffer_read_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE: { - os << (const struct ur_enqueue_mem_buffer_write_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT: { - os << (const struct ur_enqueue_mem_buffer_read_rect_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT: { - os << (const struct ur_enqueue_mem_buffer_write_rect_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY: { - os << (const struct ur_enqueue_mem_buffer_copy_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT: { - os << (const struct ur_enqueue_mem_buffer_copy_rect_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL: { - os << (const struct ur_enqueue_mem_buffer_fill_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ: { - os << (const struct ur_enqueue_mem_image_read_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE: { - os << (const struct ur_enqueue_mem_image_write_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY: { - os << (const struct ur_enqueue_mem_image_copy_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP: { - os << (const struct ur_enqueue_mem_buffer_map_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_MEM_UNMAP: { - os << (const struct ur_enqueue_mem_unmap_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_USM_FILL: { - os << (const struct ur_enqueue_usm_fill_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_USM_MEMCPY: { - os << (const struct ur_enqueue_usm_memcpy_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_USM_PREFETCH: { - os << (const struct ur_enqueue_usm_prefetch_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_USM_ADVISE: { - os << (const struct ur_enqueue_usm_advise_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_USM_FILL_2D: { - os << (const struct ur_enqueue_usm_fill_2d_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D: { - os << (const struct ur_enqueue_usm_memcpy_2d_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE: { - os << (const struct ur_enqueue_device_global_variable_write_params_t *) - params; - } break; - case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ: { - os << (const struct ur_enqueue_device_global_variable_read_params_t *) - params; - } break; - case UR_FUNCTION_ENQUEUE_READ_HOST_PIPE: { - os << (const struct ur_enqueue_read_host_pipe_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE: { - os << (const struct ur_enqueue_write_host_pipe_params_t *)params; - } break; - case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: { - os << (const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *) - params; - } break; case UR_FUNCTION_EVENT_GET_INFO: { os << (const struct ur_event_get_info_params_t *)params; } break; @@ -16029,12 +15816,50 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_event_get_native_handle_params_t *)params; } break; case UR_FUNCTION_EVENT_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_event_create_with_native_handle_params_t *) - params; + os << (const struct ur_event_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_EVENT_SET_CALLBACK: { os << (const struct ur_event_set_callback_params_t *)params; } break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_IL: { + os << (const struct ur_program_create_with_il_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY: { + os << (const struct ur_program_create_with_binary_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_BUILD: { + os << (const struct ur_program_build_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_COMPILE: { + os << (const struct ur_program_compile_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_LINK: { + os << (const struct ur_program_link_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_RETAIN: { + os << (const struct ur_program_retain_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_RELEASE: { + os << (const struct ur_program_release_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER: { + os << (const struct ur_program_get_function_pointer_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_INFO: { + os << (const struct ur_program_get_info_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_BUILD_INFO: { + os << (const struct ur_program_get_build_info_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS: { + os << (const struct ur_program_set_specialization_constants_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE: { + os << (const struct ur_program_get_native_handle_params_t *)params; + } break; + case UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_program_create_with_native_handle_params_t *)params; + } break; case UR_FUNCTION_KERNEL_CREATE: { os << (const struct ur_kernel_create_params_t *)params; } break; @@ -16057,8 +15882,7 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_kernel_get_native_handle_params_t *)params; } break; case UR_FUNCTION_KERNEL_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_kernel_create_with_native_handle_params_t *) - params; + os << (const struct ur_kernel_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_KERNEL_SET_ARG_VALUE: { os << (const struct ur_kernel_set_arg_value_params_t *)params; @@ -16079,38 +15903,28 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_kernel_set_arg_mem_obj_params_t *)params; } break; case UR_FUNCTION_KERNEL_SET_SPECIALIZATION_CONSTANTS: { - os << (const struct ur_kernel_set_specialization_constants_params_t *) - params; + os << (const struct ur_kernel_set_specialization_constants_params_t *)params; } break; case UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP: { - os << (const struct - ur_kernel_suggest_max_cooperative_group_count_exp_params_t *) - params; + os << (const struct ur_kernel_suggest_max_cooperative_group_count_exp_params_t *)params; } break; - case UR_FUNCTION_LOADER_INIT: { - os << (const struct ur_loader_init_params_t *)params; - } break; - case UR_FUNCTION_LOADER_TEAR_DOWN: { - os << (const struct ur_loader_tear_down_params_t *)params; - } break; - case UR_FUNCTION_LOADER_CONFIG_CREATE: { - os << (const struct ur_loader_config_create_params_t *)params; + case UR_FUNCTION_SAMPLER_CREATE: { + os << (const struct ur_sampler_create_params_t *)params; } break; - case UR_FUNCTION_LOADER_CONFIG_RETAIN: { - os << (const struct ur_loader_config_retain_params_t *)params; + case UR_FUNCTION_SAMPLER_RETAIN: { + os << (const struct ur_sampler_retain_params_t *)params; } break; - case UR_FUNCTION_LOADER_CONFIG_RELEASE: { - os << (const struct ur_loader_config_release_params_t *)params; + case UR_FUNCTION_SAMPLER_RELEASE: { + os << (const struct ur_sampler_release_params_t *)params; } break; - case UR_FUNCTION_LOADER_CONFIG_GET_INFO: { - os << (const struct ur_loader_config_get_info_params_t *)params; + case UR_FUNCTION_SAMPLER_GET_INFO: { + os << (const struct ur_sampler_get_info_params_t *)params; } break; - case UR_FUNCTION_LOADER_CONFIG_ENABLE_LAYER: { - os << (const struct ur_loader_config_enable_layer_params_t *)params; + case UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE: { + os << (const struct ur_sampler_get_native_handle_params_t *)params; } break; - case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: { - os << (const struct ur_loader_config_set_code_location_callback_params_t - *)params; + case UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE: { + os << (const struct ur_sampler_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_MEM_IMAGE_CREATE: { os << (const struct ur_mem_image_create_params_t *)params; @@ -16131,12 +15945,10 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_mem_get_native_handle_params_t *)params; } break; case UR_FUNCTION_MEM_BUFFER_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_mem_buffer_create_with_native_handle_params_t *) - params; + os << (const struct ur_mem_buffer_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_MEM_IMAGE_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_mem_image_create_with_native_handle_params_t *) - params; + os << (const struct ur_mem_image_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_MEM_GET_INFO: { os << (const struct ur_mem_get_info_params_t *)params; @@ -16153,65 +15965,98 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, case UR_FUNCTION_PHYSICAL_MEM_RELEASE: { os << (const struct ur_physical_mem_release_params_t *)params; } break; - case UR_FUNCTION_PLATFORM_GET: { - os << (const struct ur_platform_get_params_t *)params; + case UR_FUNCTION_ADAPTER_GET: { + os << (const struct ur_adapter_get_params_t *)params; } break; - case UR_FUNCTION_PLATFORM_GET_INFO: { - os << (const struct ur_platform_get_info_params_t *)params; + case UR_FUNCTION_ADAPTER_RELEASE: { + os << (const struct ur_adapter_release_params_t *)params; } break; - case UR_FUNCTION_PLATFORM_GET_NATIVE_HANDLE: { - os << (const struct ur_platform_get_native_handle_params_t *)params; + case UR_FUNCTION_ADAPTER_RETAIN: { + os << (const struct ur_adapter_retain_params_t *)params; } break; - case UR_FUNCTION_PLATFORM_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_platform_create_with_native_handle_params_t *) - params; + case UR_FUNCTION_ADAPTER_GET_LAST_ERROR: { + os << (const struct ur_adapter_get_last_error_params_t *)params; } break; - case UR_FUNCTION_PLATFORM_GET_API_VERSION: { - os << (const struct ur_platform_get_api_version_params_t *)params; + case UR_FUNCTION_ADAPTER_GET_INFO: { + os << (const struct ur_adapter_get_info_params_t *)params; } break; - case UR_FUNCTION_PLATFORM_GET_BACKEND_OPTION: { - os << (const struct ur_platform_get_backend_option_params_t *)params; + case UR_FUNCTION_ENQUEUE_KERNEL_LAUNCH: { + os << (const struct ur_enqueue_kernel_launch_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_CREATE_WITH_IL: { - os << (const struct ur_program_create_with_il_params_t *)params; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT: { + os << (const struct ur_enqueue_events_wait_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_CREATE_WITH_BINARY: { - os << (const struct ur_program_create_with_binary_params_t *)params; + case UR_FUNCTION_ENQUEUE_EVENTS_WAIT_WITH_BARRIER: { + os << (const struct ur_enqueue_events_wait_with_barrier_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_BUILD: { - os << (const struct ur_program_build_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ: { + os << (const struct ur_enqueue_mem_buffer_read_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_COMPILE: { - os << (const struct ur_program_compile_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE: { + os << (const struct ur_enqueue_mem_buffer_write_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_LINK: { - os << (const struct ur_program_link_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_READ_RECT: { + os << (const struct ur_enqueue_mem_buffer_read_rect_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_RETAIN: { - os << (const struct ur_program_retain_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_WRITE_RECT: { + os << (const struct ur_enqueue_mem_buffer_write_rect_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_RELEASE: { - os << (const struct ur_program_release_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY: { + os << (const struct ur_enqueue_mem_buffer_copy_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_GET_FUNCTION_POINTER: { - os << (const struct ur_program_get_function_pointer_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_COPY_RECT: { + os << (const struct ur_enqueue_mem_buffer_copy_rect_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_GET_INFO: { - os << (const struct ur_program_get_info_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_FILL: { + os << (const struct ur_enqueue_mem_buffer_fill_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_GET_BUILD_INFO: { - os << (const struct ur_program_get_build_info_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_READ: { + os << (const struct ur_enqueue_mem_image_read_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_SET_SPECIALIZATION_CONSTANTS: { - os << (const struct ur_program_set_specialization_constants_params_t *) - params; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_WRITE: { + os << (const struct ur_enqueue_mem_image_write_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_GET_NATIVE_HANDLE: { - os << (const struct ur_program_get_native_handle_params_t *)params; + case UR_FUNCTION_ENQUEUE_MEM_IMAGE_COPY: { + os << (const struct ur_enqueue_mem_image_copy_params_t *)params; } break; - case UR_FUNCTION_PROGRAM_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_program_create_with_native_handle_params_t *) - params; + case UR_FUNCTION_ENQUEUE_MEM_BUFFER_MAP: { + os << (const struct ur_enqueue_mem_buffer_map_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_MEM_UNMAP: { + os << (const struct ur_enqueue_mem_unmap_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_FILL: { + os << (const struct ur_enqueue_usm_fill_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_MEMCPY: { + os << (const struct ur_enqueue_usm_memcpy_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_PREFETCH: { + os << (const struct ur_enqueue_usm_prefetch_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_ADVISE: { + os << (const struct ur_enqueue_usm_advise_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_FILL_2D: { + os << (const struct ur_enqueue_usm_fill_2d_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_USM_MEMCPY_2D: { + os << (const struct ur_enqueue_usm_memcpy_2d_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_WRITE: { + os << (const struct ur_enqueue_device_global_variable_write_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_DEVICE_GLOBAL_VARIABLE_READ: { + os << (const struct ur_enqueue_device_global_variable_read_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_READ_HOST_PIPE: { + os << (const struct ur_enqueue_read_host_pipe_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_WRITE_HOST_PIPE: { + os << (const struct ur_enqueue_write_host_pipe_params_t *)params; + } break; + case UR_FUNCTION_ENQUEUE_COOPERATIVE_KERNEL_LAUNCH_EXP: { + os << (const struct ur_enqueue_cooperative_kernel_launch_exp_params_t *)params; } break; case UR_FUNCTION_QUEUE_GET_INFO: { os << (const struct ur_queue_get_info_params_t *)params; @@ -16229,8 +16074,7 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_queue_get_native_handle_params_t *)params; } break; case UR_FUNCTION_QUEUE_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_queue_create_with_native_handle_params_t *) - params; + os << (const struct ur_queue_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_QUEUE_FINISH: { os << (const struct ur_queue_finish_params_t *)params; @@ -16238,24 +16082,56 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, case UR_FUNCTION_QUEUE_FLUSH: { os << (const struct ur_queue_flush_params_t *)params; } break; - case UR_FUNCTION_SAMPLER_CREATE: { - os << (const struct ur_sampler_create_params_t *)params; + case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_HANDLE_DESTROY_EXP: { + os << (const struct ur_bindless_images_unsampled_image_handle_destroy_exp_params_t *)params; } break; - case UR_FUNCTION_SAMPLER_RETAIN: { - os << (const struct ur_sampler_retain_params_t *)params; + case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_HANDLE_DESTROY_EXP: { + os << (const struct ur_bindless_images_sampled_image_handle_destroy_exp_params_t *)params; } break; - case UR_FUNCTION_SAMPLER_RELEASE: { - os << (const struct ur_sampler_release_params_t *)params; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_ALLOCATE_EXP: { + os << (const struct ur_bindless_images_image_allocate_exp_params_t *)params; } break; - case UR_FUNCTION_SAMPLER_GET_INFO: { - os << (const struct ur_sampler_get_info_params_t *)params; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_FREE_EXP: { + os << (const struct ur_bindless_images_image_free_exp_params_t *)params; } break; - case UR_FUNCTION_SAMPLER_GET_NATIVE_HANDLE: { - os << (const struct ur_sampler_get_native_handle_params_t *)params; + case UR_FUNCTION_BINDLESS_IMAGES_UNSAMPLED_IMAGE_CREATE_EXP: { + os << (const struct ur_bindless_images_unsampled_image_create_exp_params_t *)params; } break; - case UR_FUNCTION_SAMPLER_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_sampler_create_with_native_handle_params_t *) - params; + case UR_FUNCTION_BINDLESS_IMAGES_SAMPLED_IMAGE_CREATE_EXP: { + os << (const struct ur_bindless_images_sampled_image_create_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_COPY_EXP: { + os << (const struct ur_bindless_images_image_copy_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMAGE_GET_INFO_EXP: { + os << (const struct ur_bindless_images_image_get_info_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_GET_LEVEL_EXP: { + os << (const struct ur_bindless_images_mipmap_get_level_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MIPMAP_FREE_EXP: { + os << (const struct ur_bindless_images_mipmap_free_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_OPAQUE_FD_EXP: { + os << (const struct ur_bindless_images_import_opaque_fd_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_MAP_EXTERNAL_ARRAY_EXP: { + os << (const struct ur_bindless_images_map_external_array_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_RELEASE_INTEROP_EXP: { + os << (const struct ur_bindless_images_release_interop_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_IMPORT_EXTERNAL_SEMAPHORE_OPAQUE_FD_EXP: { + os << (const struct ur_bindless_images_import_external_semaphore_opaque_fd_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_DESTROY_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct ur_bindless_images_destroy_external_semaphore_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_WAIT_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct ur_bindless_images_wait_external_semaphore_exp_params_t *)params; + } break; + case UR_FUNCTION_BINDLESS_IMAGES_SIGNAL_EXTERNAL_SEMAPHORE_EXP: { + os << (const struct ur_bindless_images_signal_external_semaphore_exp_params_t *)params; } break; case UR_FUNCTION_USM_HOST_ALLOC: { os << (const struct ur_usm_host_alloc_params_t *)params; @@ -16293,20 +16169,74 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, case UR_FUNCTION_USM_RELEASE_EXP: { os << (const struct ur_usm_release_exp_params_t *)params; } break; + case UR_FUNCTION_COMMAND_BUFFER_CREATE_EXP: { + os << (const struct ur_command_buffer_create_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_RETAIN_EXP: { + os << (const struct ur_command_buffer_retain_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_RELEASE_EXP: { + os << (const struct ur_command_buffer_release_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_FINALIZE_EXP: { + os << (const struct ur_command_buffer_finalize_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_KERNEL_LAUNCH_EXP: { + os << (const struct ur_command_buffer_append_kernel_launch_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_MEMCPY_EXP: { + os << (const struct ur_command_buffer_append_usm_memcpy_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_FILL_EXP: { + os << (const struct ur_command_buffer_append_usm_fill_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_copy_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_write_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_read_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_COPY_RECT_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_copy_rect_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_WRITE_RECT_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_write_rect_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_READ_RECT_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_read_rect_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_MEM_BUFFER_FILL_EXP: { + os << (const struct ur_command_buffer_append_mem_buffer_fill_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP: { + os << (const struct ur_command_buffer_append_usm_prefetch_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: { + os << (const struct ur_command_buffer_append_usm_advise_exp_params_t *)params; + } break; + case UR_FUNCTION_COMMAND_BUFFER_ENQUEUE_EXP: { + os << (const struct ur_command_buffer_enqueue_exp_params_t *)params; + } break; case UR_FUNCTION_USM_P2P_ENABLE_PEER_ACCESS_EXP: { os << (const struct ur_usm_p2p_enable_peer_access_exp_params_t *)params; } break; case UR_FUNCTION_USM_P2P_DISABLE_PEER_ACCESS_EXP: { - os << (const struct ur_usm_p2p_disable_peer_access_exp_params_t *) - params; + os << (const struct ur_usm_p2p_disable_peer_access_exp_params_t *)params; } break; case UR_FUNCTION_USM_P2P_PEER_ACCESS_GET_INFO_EXP: { - os << (const struct ur_usm_p2p_peer_access_get_info_exp_params_t *) - params; + os << (const struct ur_usm_p2p_peer_access_get_info_exp_params_t *)params; + } break; + case UR_FUNCTION_LOADER_INIT: { + os << (const struct ur_loader_init_params_t *)params; + } break; + case UR_FUNCTION_LOADER_TEAR_DOWN: { + os << (const struct ur_loader_tear_down_params_t *)params; } break; case UR_FUNCTION_VIRTUAL_MEM_GRANULARITY_GET_INFO: { - os << (const struct ur_virtual_mem_granularity_get_info_params_t *) - params; + os << (const struct ur_virtual_mem_granularity_get_info_params_t *)params; } break; case UR_FUNCTION_VIRTUAL_MEM_RESERVE: { os << (const struct ur_virtual_mem_reserve_params_t *)params; @@ -16348,17 +16278,17 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, os << (const struct ur_device_get_native_handle_params_t *)params; } break; case UR_FUNCTION_DEVICE_CREATE_WITH_NATIVE_HANDLE: { - os << (const struct ur_device_create_with_native_handle_params_t *) - params; + os << (const struct ur_device_create_with_native_handle_params_t *)params; } break; case UR_FUNCTION_DEVICE_GET_GLOBAL_TIMESTAMPS: { os << (const struct ur_device_get_global_timestamps_params_t *)params; } break; default: - return -1; + return UR_RESULT_ERROR_INVALID_ENUMERATION; } - return 0; + return UR_RESULT_SUCCESS; } -} // namespace ur_print +} // namespace extras +} // namespace ur #endif /* UR_PRINT_HPP */ diff --git a/scripts/Doxyfile b/scripts/Doxyfile index 0134f27418..199fd6afdc 100644 --- a/scripts/Doxyfile +++ b/scripts/Doxyfile @@ -848,7 +848,8 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = README.md +EXCLUDE = README.md \ + ../include/ur_print.hpp # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded diff --git a/scripts/core/INTRO.rst b/scripts/core/INTRO.rst index d3a862ad87..255fe84e50 100644 --- a/scripts/core/INTRO.rst +++ b/scripts/core/INTRO.rst @@ -145,6 +145,14 @@ and followed by a digit or uppercase letter are reserved for use by the implemen Applications which use Unified Runtime must not provide definitions of these symbols. This allows the Unified Runtime shared library to be updated with additional symbols for new API versions or extensions without causing symbol conflicts with existing applications. +Printing API +------------ +## --validate=off +The header "${x}_print.hpp" contains the "${x}::print" namespace with the output stream operator (<<) overloads for Unified Runtime objects. +There is also the "${x}::extras::printFunctionParams" function for printing function parameters. These parameters have to be provided in a \*params_t struct format suitable for +a given function. +## --validate=on + Tracing --------------------- diff --git a/scripts/generate_code.py b/scripts/generate_code.py index 0d391b1747..1cf6a986e3 100644 --- a/scripts/generate_code.py +++ b/scripts/generate_code.py @@ -97,6 +97,7 @@ def _generate_api_cpp(incpath, srcpath, namespace, tags, version, revision, spec loc = _mako_api_h(incpath, namespace, tags, version, revision, specs, meta) loc += _mako_api_cpp(srcpath, namespace, tags, version, revision, specs, meta) loc += _mako_ddi_h(incpath, namespace, tags, version, revision, specs, meta) + loc += _mako_print_hpp(incpath, namespace, tags, version, revision, specs, meta) return loc @@ -278,7 +279,7 @@ def _mako_tracing_layer_cpp(path, namespace, tags, version, specs, meta): """ generates c/c++ files from the specification documents """ -def _mako_print_hpp(path, namespace, tags, version, specs, meta): +def _mako_print_hpp(path, namespace, tags, version, revision, specs, meta): template = "print.hpp.mako" fin = os.path.join(templates_dir, template) @@ -291,6 +292,7 @@ def _mako_print_hpp(path, namespace, tags, version, specs, meta): fin, fout, name=name, ver=version, + rev=revision, namespace=namespace, tags=tags, specs=specs, @@ -361,6 +363,5 @@ def generate_common(path, section, namespace, tags, version, specs, meta): os.makedirs(layer_dstpath, exist_ok=True) loc = 0 - loc += _mako_print_hpp(layer_dstpath, namespace, tags, version, specs, meta) print("COMMON Generated %s lines of code.\n"%loc) diff --git a/scripts/templates/print.hpp.mako b/scripts/templates/print.hpp.mako index 51d33bf684..b4976eaf6b 100644 --- a/scripts/templates/print.hpp.mako +++ b/scripts/templates/print.hpp.mako @@ -16,6 +16,7 @@ from templates import helper as th * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ${name}.hpp + * @version v${ver}-r${rev} * */ #ifndef ${X}_PRINT_HPP @@ -25,17 +26,18 @@ from templates import helper as th #include #include +## Mako helper functions ###################################################### <%def name="member(iname, itype, loop)"> %if iname == "pNext": - printStruct(os, ${caller.body()}); + details::printStruct(os, ${caller.body()}); %elif th.type_traits.is_flags(itype): - printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); + details::printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); %elif not loop and th.type_traits.is_pointer(itype): - printPtr(os, ${caller.body()}); + details::printPtr(os, ${caller.body()}); %elif loop and th.type_traits.is_pointer_to_pointer(itype): - printPtr(os, ${caller.body()}); + details::printPtr(os, ${caller.body()}); %elif th.type_traits.is_handle(itype): - printPtr(os, ${caller.body()}); + details::printPtr(os, ${caller.body()}); %elif iname and iname.startswith("pfn"): os << reinterpret_cast(${caller.body()}); %else: @@ -83,7 +85,7 @@ def findMemberType(_item): os << "}"; %elif findMemberType(item) is not None and findMemberType(item)['type'] == "union": os << ".${iname} = "; - printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); + details::printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); %elif th.type_traits.is_array(item['type']): os << ".${iname} = {"; for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){ @@ -97,7 +99,7 @@ def findMemberType(_item): os << "}"; %elif typename is not None: os << ".${iname} = "; - printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); + details::printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); %else: os << ".${iname} = "; <%call expr="member(iname, itype, False)"> @@ -106,7 +108,10 @@ def findMemberType(_item): %endif -namespace ${x}_print { +namespace ${x} { +namespace print { +## API functions declarations ################################################# +namespace details { template struct is_handle : std::false_type {}; %for spec in specs: %for obj in spec['objects']: @@ -117,65 +122,70 @@ template <> struct is_handle<${th.make_type_name(n, tags, obj)}> : std::true_typ %endfor template inline constexpr bool is_handle_v = is_handle::value; -template inline void printPtr(std::ostream &os, const T *ptr); -template inline void printFlag(std::ostream &os, uint32_t flag); -template inline void printTagged(std::ostream &os, const void *ptr, T value, size_t size); +template inline ${x}_result_t printPtr(std::ostream &os, const T *ptr); +template inline ${x}_result_t printFlag(std::ostream &os, uint32_t flag); +template inline ${x}_result_t printTagged(std::ostream &os, const void *ptr, T value, size_t size); %for spec in specs: %for obj in spec['objects']: ## ENUM ####################################################################### %if re.match(r"enum", obj['type']): %if obj.get('typed_etors', False) is True: - template <> inline void printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size); + template <> inline ${x}_result_t printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size); %elif "structure_type" in obj['name']: - inline void printStruct(std::ostream &os, const void *ptr); + inline ${x}_result_t printStruct(std::ostream &os, const void *ptr); %endif %endif +## UNION ###################################################################### %if re.match(r"union", obj['type']) and obj['name']: <% tag = [_obj for _s in specs for _obj in _s['objects'] if _obj['name'] == obj['tag']][0] %> - inline void printUnion( + inline ${x}_result_t printUnion( std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params, const ${tag['type']} ${th.make_type_name(n, tags, tag)} tag ); %endif - +## FLAG ####################################################################### %if th.type_traits.is_flags(obj['name']): - template<> inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag); + template<> inline ${x}_result_t printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag); %endif %endfor # obj in spec['objects'] %endfor +} // namespace details %for spec in specs: %for obj in spec['objects']: -## ENUM ####################################################################### %if re.match(r"enum", obj['type']): - inline std::ostream &operator<<(std::ostream &os, enum ${th.make_enum_name(n, tags, obj)} value); + ${X}_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ${th.make_enum_name(n, tags, obj)} value); %elif re.match(r"struct", obj['type']): - inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ${obj['type']} ${th.make_type_name(n, tags, obj)} params); + ${X}_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ${obj['type']} ${th.make_type_name(n, tags, obj)} params); %endif %endfor # obj in spec['objects'] %endfor +## API functions definitions ################################################## %for spec in specs: %for obj in spec['objects']: ## ENUM ####################################################################### %if re.match(r"enum", obj['type']): + /////////////////////////////////////////////////////////////////////////////// + /// @brief Print operator for the ${th.make_enum_name(n, tags, obj)} type + /// @returns + /// std::ostream & %if "api_version" in obj['name']: - inline std::ostream &operator<<(std::ostream &os, enum ${th.make_enum_name(n, tags, obj)} value) { + inline std::ostream &operator<<(std::ostream &os, ${th.make_enum_name(n, tags, obj)} value) { os << UR_MAJOR_VERSION(value) << "." << UR_MINOR_VERSION(value); return os; } %else: - inline std::ostream &operator<<(std::ostream &os, enum ${th.make_enum_name(n, tags, obj)} value) { + inline std::ostream &operator<<(std::ostream &os, ${th.make_enum_name(n, tags, obj)} value) { switch (value) { %for n, item in enumerate(obj['etors']): <% ename = th.make_etor_name(n, tags, obj['name'], item['name']) - %> - case ${ename}: + %>case ${ename}: os << "${ename}"; break; %endfor @@ -187,11 +197,13 @@ template inline void printTagged(std::ostream &os, const void *ptr, } %endif %if obj.get('typed_etors', False) is True: + namespace details { + /////////////////////////////////////////////////////////////////////////////// + /// @brief Print ${th.make_enum_name(n, tags, obj)} enum value template <> - inline void printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size) { + inline ${x}_result_t printTagged(std::ostream &os, const void *ptr, ${th.make_enum_name(n, tags, obj)} value, size_t size) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } switch (value) { @@ -199,8 +211,7 @@ template inline void printTagged(std::ostream &os, const void *ptr, <% ename = th.make_etor_name(n, tags, obj['name'], item['name']) vtype = th.etor_get_associated_type(n, tags, item) - %> - case ${ename}: { + %>case ${ename}: { %if th.value_traits.is_array(vtype): <% atype = th.value_traits.get_array_name(vtype) %> %if 'void' in atype: @@ -231,7 +242,7 @@ template inline void printTagged(std::ostream &os, const void *ptr, %endif if (sizeof(${vtype}) > size) { os << "invalid size (is: " << size << ", expected: >=" << sizeof(${vtype}) << ")"; - return; + return ${X}_RESULT_ERROR_INVALID_SIZE; } os << (const void *)(tptr) << " ("; <%call expr="member(tptr, vtype, False)"> @@ -243,15 +254,19 @@ template inline void printTagged(std::ostream &os, const void *ptr, %endfor default: os << "unknown enumerator"; - break; + return ${X}_RESULT_ERROR_INVALID_ENUMERATION; } + return ${X}_RESULT_SUCCESS; } + } // namespace details %elif "structure_type" in obj['name']: - inline void printStruct(std::ostream &os, const void *ptr) { + namespace details { + /////////////////////////////////////////////////////////////////////////////// + /// @brief Print ${th.make_enum_name(n, tags, obj)} struct + inline ${x}_result_t printStruct(std::ostream &os, const void *ptr) { if (ptr == NULL) { - printPtr(os, ptr); - return; + return printPtr(os, ptr); } ## structure type enum value must be first @@ -268,46 +283,57 @@ template inline void printTagged(std::ostream &os, const void *ptr, %endfor default: os << "unknown enumerator"; - break; + return ${X}_RESULT_ERROR_INVALID_ENUMERATION; } + return ${X}_RESULT_SUCCESS; } + } // namespace details %endif -%if th.type_traits.is_flags(obj['name']): + %if th.type_traits.is_flags(obj['name']): -template<> -inline void printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag) { - uint32_t val = flag; - bool first = true; - %for n, item in enumerate(obj['etors']): - <% - ename = th.make_etor_name(n, tags, obj['name'], item['name']) - %> - if ((val & ${ename}) == (uint32_t)${ename}) { - ## toggle the bits to avoid printing overlapping values - ## instead of e.g., FLAG_FOO | FLAG_BAR | FLAG_ALL, this will just - ## print FLAG_FOO | FLAG_BAR (or just FLAG_ALL, depending on order). - val ^= (uint32_t)${ename}; + namespace details { + /////////////////////////////////////////////////////////////////////////////// + /// @brief Print ${th.make_enum_name(n, tags, obj)} flag + template<> + inline ${x}_result_t printFlag<${th.make_enum_name(n, tags, obj)}>(std::ostream &os, uint32_t flag) { + uint32_t val = flag; + bool first = true; + %for n, item in enumerate(obj['etors']): + <% + ename = th.make_etor_name(n, tags, obj['name'], item['name']) + %> + if ((val & ${ename}) == (uint32_t)${ename}) { + ## toggle the bits to avoid printing overlapping values + ## instead of e.g., FLAG_FOO | FLAG_BAR | FLAG_ALL, this will just + ## print FLAG_FOO | FLAG_BAR (or just FLAG_ALL, depending on order). + val ^= (uint32_t)${ename}; + if (!first) { + os << " | "; + } else { + first = false; + } + os << ${ename}; + } + %endfor + if (val != 0) { + std::bitset<32> bits(val); if (!first) { os << " | "; - } else { - first = false; } - os << ${ename}; + os << "unknown bit flags " << bits; + } else if (first) { + os << "0"; } - %endfor - if (val != 0) { - std::bitset<32> bits(val); - if (!first) { - os << " | "; - } - os << "unknown bit flags " << bits; - } else if (first) { - os << "0"; + return ${X}_RESULT_SUCCESS; } -} -%endif -## STRUCT/UNION ############################################################### + } // namespace details + %endif +## STRUCT ##################################################################### %elif re.match(r"struct", obj['type']): +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ${th.make_type_name(n, tags, obj)} type +/// @returns +/// std::ostream & inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params) { os << "(${obj['type']} ${th.make_type_name(n, tags, obj)}){"; <% @@ -324,9 +350,13 @@ inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make os << "}"; return os; } +## UNION ###################################################################### %elif re.match(r"union", obj['type']) and obj['name']: +namespace details { <% tag = findUnionTag(obj) %> -inline void printUnion( + /////////////////////////////////////////////////////////////////////////////// + // @brief Print ${th.make_type_name(n, tags, obj)} union + inline ${x}_result_t printUnion( std::ostream &os, const ${obj['type']} ${th.make_type_name(n, tags, obj)} params, const ${tag['type']} ${th.make_type_name(n, tags, tag)} tag @@ -347,10 +377,12 @@ for item in obj['members']: %endfor default: os << ""; - break; + return ${X}_RESULT_ERROR_INVALID_ENUMERATION; } os << "}"; + return ${X}_RESULT_SUCCESS; } +} // namespace details %endif %endfor # obj in spec['objects'] %endfor @@ -358,6 +390,10 @@ for item in obj['members']: %for tbl in th.get_pfncbtables(specs, meta, n, tags): %for obj in tbl['functions']: +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ${th.make_pfncb_param_type(n, tags, obj)} type +/// @returns +/// std::ostream & inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ${th.make_pfncb_param_type(n, tags, obj)} *params) { <% params_dict = dict() @@ -375,7 +411,10 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct %endfor %endfor -template inline void printPtr(std::ostream &os, const T *ptr) { +namespace details { +/////////////////////////////////////////////////////////////////////////////// +// @brief Print pointer value +template inline ${x}_result_t printPtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; } else if constexpr (std::is_pointer_v) { @@ -393,10 +432,28 @@ template inline void printPtr(std::ostream &os, const T *ptr) { os << *ptr; os << ")"; } + + return ${X}_RESULT_SUCCESS; } +} // namespace details +} // namespace print + +namespace extras { +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print function parameters +/// @returns +/// - ::${X}_RESULT_SUCCESS +/// - ::${X}_RESULT_ERROR_INVALID_ENUMERATION +/// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER +/// - `NULL == params` +${X}_APIEXPORT inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { + using namespace print; + + if (!params) { + return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; + } -inline int printFunctionParams(std::ostream &os, uint32_t function, const void *params) { - switch((enum ${x}_function_t)function) { + switch(function) { %for tbl in th.get_pfncbtables(specs, meta, n, tags): %for obj in tbl['functions']: case ${th.make_func_etor(n, tags, obj)}: { @@ -404,10 +461,11 @@ inline int printFunctionParams(std::ostream &os, uint32_t function, const void * } break; %endfor %endfor - default: return -1; + default: return ${X}_RESULT_ERROR_INVALID_ENUMERATION; } - return 0; + return ${X}_RESULT_SUCCESS; } -} // namespace ur_print +} // namespace extras +} // namespace ${x} #endif /* ${X}_PRINT_HPP */ diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index 4f3a0b9c80..f63d30d809 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -16,7 +16,7 @@ #include "ur_print.hpp" namespace logger { -using namespace ur_print; +using namespace ur::print; class Sink { public: diff --git a/test/loader/loader_lifetime/urLoaderInit.cpp b/test/loader/loader_lifetime/urLoaderInit.cpp index c2361faf6e..693cf273f2 100644 --- a/test/loader/loader_lifetime/urLoaderInit.cpp +++ b/test/loader/loader_lifetime/urLoaderInit.cpp @@ -17,7 +17,7 @@ INSTANTIATE_TEST_SUITE_P( UR_DEVICE_INIT_FLAG_FPGA | UR_DEVICE_INIT_FLAG_VPU), [](const ::testing::TestParamInfo &info) { std::stringstream ss; - ur_print::printFlag(ss, info.param); + ur::print::details::printFlag(ss, info.param); return GTestSanitizeString(ss.str()); }); diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index 41e427ff0d..82a7d946d4 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -405,7 +405,7 @@ typedef Typesfunction_id, - args->args_data); + ur::extras::printFunctionParams( + args_str, (enum ur_function_t)args->function_id, args->args_data); } if (trace_type == TRACE_FN_BEGIN) { From e4398010cf83eb81a062c2aea1063c5e9b8d4390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Plewa?= Date: Wed, 25 Oct 2023 16:45:18 +0200 Subject: [PATCH 071/145] add missing new lines in logger error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Łukasz Plewa --- source/common/logger/ur_sinks.hpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index 66322e98a6..01362828b5 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -65,16 +65,17 @@ class Sink { if (*(++fmt) == '{') { buffer << *fmt++; } else { - std::cerr - << error_prefix - << "No arguments provided and braces not escaped!"; + std::cerr << error_prefix + << "No arguments provided and braces not escaped!" + << std::endl; } } else if (*fmt == '}') { if (*(++fmt) == '}') { buffer << *fmt++; } else { std::cerr << error_prefix - << "Closing curly brace not escaped!"; + << "Closing curly brace not escaped!" + << std::endl; } } } @@ -95,7 +96,7 @@ class Sink { buffer << *fmt++; } else if (*fmt != '}') { std::cerr << error_prefix - << "Only empty braces are allowed!"; + << "Only empty braces are allowed!" << std::endl; } else { buffer << arg; arg_printed = true; @@ -105,7 +106,8 @@ class Sink { buffer << *fmt++; } else { std::cerr << error_prefix - << "Closing curly brace not escaped!"; + << "Closing curly brace not escaped!" + << std::endl; } } } From 5a5b5b9822c772fbee70170cd5c34775079fc97e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Stolarczuk?= Date: Thu, 26 Oct 2023 12:33:42 +0200 Subject: [PATCH 072/145] [CI] Split E2E steps into two GITHUB env vars are set only from the next step up, not right away. --- .github/workflows/e2e_nightly.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e_nightly.yml b/.github/workflows/e2e_nightly.yml index 8dbb5d3e74..b4cff2d1d4 100644 --- a/.github/workflows/e2e_nightly.yml +++ b/.github/workflows/e2e_nightly.yml @@ -94,10 +94,14 @@ jobs: cp ${{github.workspace}}/ur-repo/build/lib/libur_loader.so* ${{github.workspace}}/sycl_build/lib/ cp ${{github.workspace}}/ur-repo/build/lib/libur_adapter_cuda.so* ${{github.workspace}}/sycl_build/lib/ - - name: Setup SYCL + - name: Set additional env. vars run: | echo "${{github.workspace}}/sycl_build/bin" >> $GITHUB_PATH echo "LD_LIBRARY_PATH=${{github.workspace}}/sycl_build/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV + + # Running (newly built) sycl-ls sets up some extra variables + - name: Setup SYCL variables + run: | which clang++ sycl-ls SYCL_PI_TRACE=-1 sycl-ls From 4e56410c846e6b51776ea4edc7c469125e027dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Plewa?= Date: Wed, 25 Oct 2023 16:29:31 +0200 Subject: [PATCH 073/145] Fix infinite loop in logger. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When there where was more arguments then "{}" in the format string program hanged up due to infinite loop in format function. Signed-off-by: Łukasz Plewa --- source/common/logger/ur_sinks.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index 01362828b5..726b7042c4 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -110,6 +110,13 @@ class Sink { << std::endl; } } + + if (*fmt == '\0') { + std::cerr << error_prefix << "Too many arguments!" << std::endl; + // ignore all left arguments and finalize message + format(buffer, fmt); + return; + } } format(buffer, ++fmt, std::forward(args)...); From e5df409c5122d8eb0491f7f3b2cdb0b55fc523c6 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Mon, 2 Oct 2023 22:58:16 +0000 Subject: [PATCH 074/145] [UR][L0] Add support for passing device list to urProgramBuild piProgramBuild receives a list of devices, while urProgramBuild does not. This produces a series of issues when a UR program needs to be created for a specific device. So define a new API, called urProgramBuildExp to pass this list. Authored-by: jaime.a.arteaga.molina@intel.com --- include/ur.py | 29 +++++- include/ur_api.h | 52 +++++++++- include/ur_ddi.h | 37 ++++++++ include/ur_print.hpp | 49 ++++++++++ scripts/core/program.yml | 33 +++++++ scripts/core/registry.yml | 5 +- source/adapters/null/ur_nullddi.cpp | 57 +++++++++++ source/loader/layers/tracing/ur_trcddi.cpp | 69 ++++++++++++++ source/loader/layers/validation/ur_valddi.cpp | 76 +++++++++++++++ source/loader/ur_ldrddi.cpp | 94 +++++++++++++++++++ source/loader/ur_libapi.cpp | 47 ++++++++++ source/loader/ur_libddi.cpp | 5 + source/ur_api.cpp | 41 ++++++++ 13 files changed, 591 insertions(+), 3 deletions(-) diff --git a/include/ur.py b/include/ur.py index 13996b1815..88d45dbea6 100644 --- a/include/ur.py +++ b/include/ur.py @@ -202,7 +202,8 @@ class ur_function_v(IntEnum): KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194## Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195 ## Enumerator for ::urCommandBufferAppendUSMPrefetchExp COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196 ## Enumerator for ::urCommandBufferAppendUSMAdviseExp - LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 197 ## Enumerator for ::urLoaderConfigSetCodeLocationCallback + PROGRAM_BUILD_EXP = 197 ## Enumerator for ::urProgramBuildExp + LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 198 ## Enumerator for ::urLoaderConfigSetCodeLocationCallback class ur_function_t(c_int): def __str__(self): @@ -2631,6 +2632,21 @@ class ur_program_dditable_t(Structure): ("pfnCreateWithNativeHandle", c_void_p) ## _urProgramCreateWithNativeHandle_t ] +############################################################################### +## @brief Function-pointer for urProgramBuildExp +if __use_win_types: + _urProgramBuildExp_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) +else: + _urProgramBuildExp_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) + + +############################################################################### +## @brief Table of ProgramExp functions pointers +class ur_program_exp_dditable_t(Structure): + _fields_ = [ + ("pfnBuildExp", c_void_p) ## _urProgramBuildExp_t + ] + ############################################################################### ## @brief Function-pointer for urKernelCreate if __use_win_types: @@ -3862,6 +3878,7 @@ class ur_dditable_t(Structure): ("Context", ur_context_dditable_t), ("Event", ur_event_dditable_t), ("Program", ur_program_dditable_t), + ("ProgramExp", ur_program_exp_dditable_t), ("Kernel", ur_kernel_dditable_t), ("KernelExp", ur_kernel_exp_dditable_t), ("Sampler", ur_sampler_dditable_t), @@ -3966,6 +3983,16 @@ def __init__(self, version : ur_api_version_t): self.urProgramGetNativeHandle = _urProgramGetNativeHandle_t(self.__dditable.Program.pfnGetNativeHandle) self.urProgramCreateWithNativeHandle = _urProgramCreateWithNativeHandle_t(self.__dditable.Program.pfnCreateWithNativeHandle) + # call driver to get function pointers + ProgramExp = ur_program_exp_dditable_t() + r = ur_result_v(self.__dll.urGetProgramExpProcAddrTable(version, byref(ProgramExp))) + if r != ur_result_v.SUCCESS: + raise Exception(r) + self.__dditable.ProgramExp = ProgramExp + + # attach function interface to function address + self.urProgramBuildExp = _urProgramBuildExp_t(self.__dditable.ProgramExp.pfnBuildExp) + # call driver to get function pointers Kernel = ur_kernel_dditable_t() r = ur_result_v(self.__dll.urGetKernelProcAddrTable(version, byref(Kernel))) diff --git a/include/ur_api.h b/include/ur_api.h index 1504c0b1b2..88fd478048 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -211,7 +211,8 @@ typedef enum ur_function_t { UR_FUNCTION_KERNEL_SUGGEST_MAX_COOPERATIVE_GROUP_COUNT_EXP = 194, ///< Enumerator for ::urKernelSuggestMaxCooperativeGroupCountExp UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp - UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 197, ///< Enumerator for ::urLoaderConfigSetCodeLocationCallback + UR_FUNCTION_PROGRAM_BUILD_EXP = 197, ///< Enumerator for ::urProgramBuildExp + UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 198, ///< Enumerator for ::urLoaderConfigSetCodeLocationCallback /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -4075,6 +4076,43 @@ urProgramBuild( const char *pOptions ///< [in][optional] pointer to build options null-terminated string. ); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `hContext`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL +urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char *pOptions ///< [in][optional] pointer to build options null-terminated string. +); + /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one or more programs. /// @@ -8919,6 +8957,18 @@ typedef struct ur_program_build_params_t { const char **ppOptions; } ur_program_build_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramBuildExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_build_exp_params_t { + ur_context_handle_t *phContext; + ur_program_handle_t *phProgram; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + const char **ppOptions; +} ur_program_build_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urProgramCompile /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 246ffc200d..3b99004820 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -408,6 +408,42 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetProgramProcAddrTable_t)( ur_api_version_t, ur_program_dditable_t *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramBuildExp +typedef ur_result_t(UR_APICALL *ur_pfnProgramBuildExp_t)( + ur_context_handle_t, + ur_program_handle_t, + uint32_t, + ur_device_handle_t *, + const char *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Table of ProgramExp functions pointers +typedef struct ur_program_exp_dditable_t { + ur_pfnProgramBuildExp_t pfnBuildExp; +} ur_program_exp_dditable_t; + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's ProgramExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL +urGetProgramExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_program_exp_dditable_t *pDdiTable ///< [in,out] pointer to table of DDI function pointers +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urGetProgramExpProcAddrTable +typedef ur_result_t(UR_APICALL *ur_pfnGetProgramExpProcAddrTable_t)( + ur_api_version_t, + ur_program_exp_dditable_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urKernelCreate typedef ur_result_t(UR_APICALL *ur_pfnKernelCreate_t)( @@ -2250,6 +2286,7 @@ typedef struct ur_dditable_t { ur_context_dditable_t Context; ur_event_dditable_t Event; ur_program_dditable_t Program; + ur_program_exp_dditable_t ProgramExp; ur_kernel_dditable_t Kernel; ur_kernel_exp_dditable_t KernelExp; ur_sampler_dditable_t Sampler; diff --git a/include/ur_print.hpp b/include/ur_print.hpp index 6a47b955bc..b239f7dfeb 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -869,6 +869,9 @@ inline std::ostream &operator<<(std::ostream &os, ur_function_t value) { case UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP: os << "UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP"; break; + case UR_FUNCTION_PROGRAM_BUILD_EXP: + os << "UR_FUNCTION_PROGRAM_BUILD_EXP"; + break; case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: os << "UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK"; break; @@ -9987,6 +9990,49 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct return os; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_build_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_build_exp_params_t *params) { + + os << ".hContext = "; + + details::printPtr(os, + *(params->phContext)); + + os << ", "; + os << ".hProgram = "; + + details::printPtr(os, + *(params->phProgram)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = {"; + for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphDevices))[i]); + } + os << "}"; + + os << ", "; + os << ".pOptions = "; + + details::printPtr(os, + *(params->ppOptions)); + + return os; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_program_compile_params_t type /// @returns @@ -15830,6 +15876,9 @@ UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_PROGRAM_BUILD: { os << (const struct ur_program_build_params_t *)params; } break; + case UR_FUNCTION_PROGRAM_BUILD_EXP: { + os << (const struct ur_program_build_exp_params_t *)params; + } break; case UR_FUNCTION_PROGRAM_COMPILE: { os << (const struct ur_program_compile_params_t *)params; } break; diff --git a/scripts/core/program.yml b/scripts/core/program.yml index acab24c3bd..4886cb83cc 100644 --- a/scripts/core/program.yml +++ b/scripts/core/program.yml @@ -182,6 +182,39 @@ returns: - "If an error occurred when building `hProgram`." --- #-------------------------------------------------------------------------- type: function +desc: "Produces an executable program from one program, negates need for the linking step." +class: $xProgram +name: BuildExp +ordinal: "2" +decl: static +analogue: + - "**clBuildProgram**" +details: + - "The application may call this function from simultaneous threads." + - "Following a successful call to this entry point, the program passed will contain a binary of the $X_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in `hContext`." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context instance." + - type: $x_program_handle_t + name: hProgram + desc: "[in] Handle of the program to build." + - type: uint32_t + name: numDevices + desc: "[in] number of devices" + - type: $x_device_handle_t* + name: phDevices + desc: "[in][range(0, numDevices)] pointer to array of device handles" + - type: const char* + name: pOptions + desc: "[in][optional] pointer to build options null-terminated string." +returns: + - $X_RESULT_ERROR_INVALID_PROGRAM: + - "If `hProgram` isn't a valid program object." + - $X_RESULT_ERROR_PROGRAM_BUILD_FAILURE: + - "If an error occurred when building `hProgram`." +--- #-------------------------------------------------------------------------- +type: function desc: "Produces an executable program from one or more programs." class: $xProgram name: Compile diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 61fb2aa690..6c292b126c 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -547,9 +547,12 @@ etors: - name: COMMAND_BUFFER_APPEND_USM_ADVISE_EXP desc: Enumerator for $xCommandBufferAppendUSMAdviseExp value: '196' +- name: PROGRAM_BUILD_EXP + desc: Enumerator for $xProgramBuildExp + value: '197' - name: LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK desc: Enumerator for $xLoaderConfigSetCodeLocationCallback - value: '197' + value: '198' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index a8a4883aa1..bffc67e7f9 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -1749,6 +1749,33 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnBuildExp = d_context.urDdiTable.ProgramExp.pfnBuildExp; + if (nullptr != pfnBuildExp) { + result = + pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -5853,6 +5880,36 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramProcAddrTable( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's ProgramExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_program_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers + ) try { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (driver::d_context.version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + pDdiTable->pfnBuildExp = driver::urProgramBuildExp; + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Queue table /// with current process' addresses diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index 4cd712dbbe..ca533030e8 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -1982,6 +1982,37 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + auto pfnBuildExp = context.urDdiTable.ProgramExp.pfnBuildExp; + + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_program_build_exp_params_t params = {&hContext, &hProgram, &numDevices, + &phDevices, &pOptions}; + uint64_t instance = context.notify_begin(UR_FUNCTION_PROGRAM_BUILD_EXP, + "urProgramBuildExp", ¶ms); + + ur_result_t result = + pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); + + context.notify_end(UR_FUNCTION_PROGRAM_BUILD_EXP, "urProgramBuildExp", + ¶ms, &result, instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -6868,6 +6899,39 @@ __urdlllocal ur_result_t UR_APICALL urGetProgramProcAddrTable( return result; } /////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's ProgramExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +__urdlllocal ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_program_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + auto &dditable = ur_tracing_layer::context.urDdiTable.ProgramExp; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_tracing_layer::context.version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_tracing_layer::context.version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + dditable.pfnBuildExp = pDdiTable->pfnBuildExp; + pDdiTable->pfnBuildExp = ur_tracing_layer::urProgramBuildExp; + + return result; +} +/////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Queue table /// with current process' addresses /// @@ -7297,6 +7361,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Program); } + if (UR_RESULT_SUCCESS == result) { + result = ur_tracing_layer::urGetProgramExpProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->ProgramExp); + } + if (UR_RESULT_SUCCESS == result) { result = ur_tracing_layer::urGetQueueProcAddrTable( UR_API_VERSION_CURRENT, &dditable->Queue); diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index dca284e0d1..843d5b62ee 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -2476,6 +2476,43 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + auto pfnBuildExp = context.urDdiTable.ProgramExp.pfnBuildExp; + + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hContext) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == hProgram) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == phDevices) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + } + + ur_result_t result = + pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -8628,6 +8665,40 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's ProgramExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_program_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + auto &dditable = ur_validation_layer::context.urDdiTable.ProgramExp; + + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (UR_MAJOR_VERSION(ur_validation_layer::context.version) != + UR_MAJOR_VERSION(version) || + UR_MINOR_VERSION(ur_validation_layer::context.version) > + UR_MINOR_VERSION(version)) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + dditable.pfnBuildExp = pDdiTable->pfnBuildExp; + pDdiTable->pfnBuildExp = ur_validation_layer::urProgramBuildExp; + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Queue table /// with current process' addresses @@ -9076,6 +9147,11 @@ ur_result_t context_t::init(ur_dditable_t *dditable, UR_API_VERSION_CURRENT, &dditable->Program); } + if (UR_RESULT_SUCCESS == result) { + result = ur_validation_layer::urGetProgramExpProcAddrTable( + UR_API_VERSION_CURRENT, &dditable->ProgramExp); + } + if (UR_RESULT_SUCCESS == result) { result = ur_validation_layer::urGetQueueProcAddrTable( UR_API_VERSION_CURRENT, &dditable->Queue); diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 54c8f9b4c1..194797bd14 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -2311,6 +2311,46 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnBuildExp = dditable->ur.ProgramExp.pfnBuildExp; + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handle to platform handle + hProgram = reinterpret_cast(hProgram)->handle; + + // convert loader handles to platform handles + auto phDevicesLocal = std::vector(numDevices); + for (size_t i = 0; i < numDevices; ++i) { + phDevicesLocal[i] = + reinterpret_cast(phDevices[i])->handle; + } + + // forward to device-platform + result = pfnBuildExp(hContext, hProgram, numDevices, phDevicesLocal.data(), + pOptions); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -8054,6 +8094,60 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramProcAddrTable( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Exported function for filling application's ProgramExp table +/// with current process' addresses +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// - ::UR_RESULT_ERROR_UNSUPPORTED_VERSION +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ///< [in] API version requested + ur_program_exp_dditable_t + *pDdiTable ///< [in,out] pointer to table of DDI function pointers +) { + if (nullptr == pDdiTable) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (ur_loader::context->version < version) { + return UR_RESULT_ERROR_UNSUPPORTED_VERSION; + } + + ur_result_t result = UR_RESULT_SUCCESS; + + // Load the device-platform DDI tables + for (auto &platform : ur_loader::context->platforms) { + if (platform.initStatus != UR_RESULT_SUCCESS) { + continue; + } + auto getTable = reinterpret_cast( + ur_loader::LibLoader::getFunctionPtr( + platform.handle.get(), "urGetProgramExpProcAddrTable")); + if (!getTable) { + continue; + } + platform.initStatus = + getTable(version, &platform.dditable.ur.ProgramExp); + } + + if (UR_RESULT_SUCCESS == result) { + if (ur_loader::context->platforms.size() != 1 || + ur_loader::context->forceIntercept) { + // return pointers to loader's DDIs + pDdiTable->pfnBuildExp = ur_loader::urProgramBuildExp; + } else { + // return pointers directly to platform's DDIs + *pDdiTable = + ur_loader::context->platforms.front().dditable.ur.ProgramExp; + } + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Exported function for filling application's Queue table /// with current process' addresses diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 374f193902..6c7fcb6f2b 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -2968,6 +2968,53 @@ ur_result_t UR_APICALL urProgramBuild( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `hContext`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +ur_result_t UR_APICALL urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. + ) try { + auto pfnBuildExp = ur_lib::context->urDdiTable.ProgramExp.pfnBuildExp; + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one or more programs. /// diff --git a/source/loader/ur_libddi.cpp b/source/loader/ur_libddi.cpp index 9d0a2566f4..bf28e09a71 100644 --- a/source/loader/ur_libddi.cpp +++ b/source/loader/ur_libddi.cpp @@ -84,6 +84,11 @@ __urdlllocal ur_result_t context_t::urLoaderInit() { &urDdiTable.Program); } + if (UR_RESULT_SUCCESS == result) { + result = urGetProgramExpProcAddrTable(UR_API_VERSION_CURRENT, + &urDdiTable.ProgramExp); + } + if (UR_RESULT_SUCCESS == result) { result = urGetQueueProcAddrTable(UR_API_VERSION_CURRENT, &urDdiTable.Queue); diff --git a/source/ur_api.cpp b/source/ur_api.cpp index d465a83cfa..87ad442429 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -2519,6 +2519,47 @@ ur_result_t UR_APICALL urProgramBuild( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `hContext`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +ur_result_t UR_APICALL urProgramBuildExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one or more programs. /// From c90b27bb2a1d7f7e7d1468323e7d4eafd47b7c9a Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 3 Oct 2023 12:34:19 +0100 Subject: [PATCH 075/145] [UR][L0] Add multi-device-compile experimental feature Expand upon the introduction of `urProgramBuildExp` and include `urProgramCompileExp` and `urProgramLinkExp` which include a device-list in place of a context. These more closely align with the PI/OpenCL analogues but only to introduce device-lists, not all extant arguments from those entry-points. This patch also moves the `urProgramBuildExp` definition into an experimental feature file and introduces a brief document containing motivation. --- include/ur.py | 33 ++- include/ur_api.h | 192 ++++++++++++++---- include/ur_ddi.h | 22 +- include/ur_print.hpp | 115 ++++++++++- scripts/core/EXP-MULTI-DEVICE-COMPILE.rst | 64 ++++++ scripts/core/exp-multi-device-compile.yml | 125 ++++++++++++ scripts/core/program.yml | 33 --- scripts/core/registry.yml | 8 +- source/adapters/null/ur_nullddi.cpp | 114 ++++++++--- source/loader/layers/tracing/ur_trcddi.cpp | 133 +++++++++--- source/loader/layers/validation/ur_valddi.cpp | 156 ++++++++++---- source/loader/ur_ldrddi.cpp | 174 ++++++++++++---- source/loader/ur_libapi.cpp | 192 +++++++++++++----- source/ur_api.cpp | 167 +++++++++++---- 14 files changed, 1221 insertions(+), 307 deletions(-) create mode 100644 scripts/core/EXP-MULTI-DEVICE-COMPILE.rst create mode 100644 scripts/core/exp-multi-device-compile.yml diff --git a/include/ur.py b/include/ur.py index 88d45dbea6..9ba575f339 100644 --- a/include/ur.py +++ b/include/ur.py @@ -203,7 +203,9 @@ class ur_function_v(IntEnum): COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195 ## Enumerator for ::urCommandBufferAppendUSMPrefetchExp COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196 ## Enumerator for ::urCommandBufferAppendUSMAdviseExp PROGRAM_BUILD_EXP = 197 ## Enumerator for ::urProgramBuildExp - LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 198 ## Enumerator for ::urLoaderConfigSetCodeLocationCallback + PROGRAM_COMPILE_EXP = 198 ## Enumerator for ::urProgramCompileExp + PROGRAM_LINK_EXP = 199 ## Enumerator for ::urProgramLinkExp + LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 200 ## Enumerator for ::urLoaderConfigSetCodeLocationCallback class ur_function_t(c_int): def __str__(self): @@ -2316,6 +2318,11 @@ class ur_exp_command_buffer_handle_t(c_void_p): ## which is returned when querying device extensions. UR_COOPERATIVE_KERNELS_EXTENSION_STRING_EXP = "ur_exp_cooperative_kernels" +############################################################################### +## @brief The extension string which defines support for test +## which is returned when querying device extensions. +UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP = "ur_exp_multi_device_compile" + ############################################################################### ## @brief Supported peer info class ur_exp_peer_info_v(IntEnum): @@ -2635,16 +2642,32 @@ class ur_program_dditable_t(Structure): ############################################################################### ## @brief Function-pointer for urProgramBuildExp if __use_win_types: - _urProgramBuildExp_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) + _urProgramBuildExp_t = WINFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) +else: + _urProgramBuildExp_t = CFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) + +############################################################################### +## @brief Function-pointer for urProgramCompileExp +if __use_win_types: + _urProgramCompileExp_t = WINFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) +else: + _urProgramCompileExp_t = CFUNCTYPE( ur_result_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) + +############################################################################### +## @brief Function-pointer for urProgramLinkExp +if __use_win_types: + _urProgramLinkExp_t = WINFUNCTYPE( ur_result_t, ur_context_handle_t, c_ulong, POINTER(ur_device_handle_t), c_ulong, POINTER(ur_program_handle_t), c_char_p, POINTER(ur_program_handle_t) ) else: - _urProgramBuildExp_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, ur_program_handle_t, c_ulong, POINTER(ur_device_handle_t), c_char_p ) + _urProgramLinkExp_t = CFUNCTYPE( ur_result_t, ur_context_handle_t, c_ulong, POINTER(ur_device_handle_t), c_ulong, POINTER(ur_program_handle_t), c_char_p, POINTER(ur_program_handle_t) ) ############################################################################### ## @brief Table of ProgramExp functions pointers class ur_program_exp_dditable_t(Structure): _fields_ = [ - ("pfnBuildExp", c_void_p) ## _urProgramBuildExp_t + ("pfnBuildExp", c_void_p), ## _urProgramBuildExp_t + ("pfnCompileExp", c_void_p), ## _urProgramCompileExp_t + ("pfnLinkExp", c_void_p) ## _urProgramLinkExp_t ] ############################################################################### @@ -3992,6 +4015,8 @@ def __init__(self, version : ur_api_version_t): # attach function interface to function address self.urProgramBuildExp = _urProgramBuildExp_t(self.__dditable.ProgramExp.pfnBuildExp) + self.urProgramCompileExp = _urProgramCompileExp_t(self.__dditable.ProgramExp.pfnCompileExp) + self.urProgramLinkExp = _urProgramLinkExp_t(self.__dditable.ProgramExp.pfnLinkExp) # call driver to get function pointers Kernel = ur_kernel_dditable_t() diff --git a/include/ur_api.h b/include/ur_api.h index 88fd478048..6fff45c249 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -212,7 +212,9 @@ typedef enum ur_function_t { UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_PREFETCH_EXP = 195, ///< Enumerator for ::urCommandBufferAppendUSMPrefetchExp UR_FUNCTION_COMMAND_BUFFER_APPEND_USM_ADVISE_EXP = 196, ///< Enumerator for ::urCommandBufferAppendUSMAdviseExp UR_FUNCTION_PROGRAM_BUILD_EXP = 197, ///< Enumerator for ::urProgramBuildExp - UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 198, ///< Enumerator for ::urLoaderConfigSetCodeLocationCallback + UR_FUNCTION_PROGRAM_COMPILE_EXP = 198, ///< Enumerator for ::urProgramCompileExp + UR_FUNCTION_PROGRAM_LINK_EXP = 199, ///< Enumerator for ::urProgramLinkExp + UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK = 200, ///< Enumerator for ::urLoaderConfigSetCodeLocationCallback /// @cond UR_FUNCTION_FORCE_UINT32 = 0x7fffffff /// @endcond @@ -4076,43 +4078,6 @@ urProgramBuild( const char *pOptions ///< [in][optional] pointer to build options null-terminated string. ); -/////////////////////////////////////////////////////////////////////////////// -/// @brief Produces an executable program from one program, negates need for the -/// linking step. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - Following a successful call to this entry point, the program passed -/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type -/// for each device in `hContext`. -/// -/// @remarks -/// _Analogues_ -/// - **clBuildProgram** -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hContext` -/// + `NULL == hProgram` -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == phDevices` -/// - ::UR_RESULT_ERROR_INVALID_PROGRAM -/// + If `hProgram` isn't a valid program object. -/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE -/// + If an error occurred when building `hProgram`. -UR_APIEXPORT ur_result_t UR_APICALL -urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char *pOptions ///< [in][optional] pointer to build options null-terminated string. -); - /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one or more programs. /// @@ -8446,6 +8411,131 @@ urKernelSuggestMaxCooperativeGroupCountExp( uint32_t *pGroupCountRet ///< [out] pointer to maximum number of groups ); +#if !defined(__GNUC__) +#pragma endregion +#endif +// Intel 'oneAPI' Unified Runtime Experimental APIs for multi-device compile +#if !defined(__GNUC__) +#pragma region multi device compile(experimental) +#endif +/////////////////////////////////////////////////////////////////////////////// +#ifndef UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP +/// @brief The extension string which defines support for test +/// which is returned when querying device extensions. +#define UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP "ur_exp_multi_device_compile" +#endif // UR_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL +urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char *pOptions ///< [in][optional] pointer to build options null-terminated string. +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point `hProgram` will +/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clCompileProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred while compiling `hProgram`. +UR_APIEXPORT ur_result_t UR_APICALL +urProgramCompileExp( + ur_program_handle_t hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char *pOptions ///< [in][optional] pointer to build options null-terminated string. +); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point the program returned +/// in `phProgram` will contain a binary of the +/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in +/// `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clLinkProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// + `NULL == phPrograms` +/// + `NULL == phProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If one of the programs in `phPrograms` isn't a valid program object. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE +/// + If an error occurred while linking `phPrograms`. +UR_APIEXPORT ur_result_t UR_APICALL +urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t *phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t *phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char *pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t *phProgram ///< [out] pointer to handle of program object created. +); + #if !defined(__GNUC__) #pragma endregion #endif @@ -8962,7 +9052,6 @@ typedef struct ur_program_build_params_t { /// @details Each entry is a pointer to the parameter passed to the function; /// allowing the callback the ability to modify the parameter's value typedef struct ur_program_build_exp_params_t { - ur_context_handle_t *phContext; ur_program_handle_t *phProgram; uint32_t *pnumDevices; ur_device_handle_t **pphDevices; @@ -8979,6 +9068,17 @@ typedef struct ur_program_compile_params_t { const char **ppOptions; } ur_program_compile_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramCompileExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_compile_exp_params_t { + ur_program_handle_t *phProgram; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + const char **ppOptions; +} ur_program_compile_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urProgramLink /// @details Each entry is a pointer to the parameter passed to the function; @@ -8991,6 +9091,20 @@ typedef struct ur_program_link_params_t { ur_program_handle_t **pphProgram; } ur_program_link_params_t; +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function parameters for urProgramLinkExp +/// @details Each entry is a pointer to the parameter passed to the function; +/// allowing the callback the ability to modify the parameter's value +typedef struct ur_program_link_exp_params_t { + ur_context_handle_t *phContext; + uint32_t *pnumDevices; + ur_device_handle_t **pphDevices; + uint32_t *pcount; + const ur_program_handle_t **pphPrograms; + const char **ppOptions; + ur_program_handle_t **pphProgram; +} ur_program_link_exp_params_t; + /////////////////////////////////////////////////////////////////////////////// /// @brief Function parameters for urProgramRetain /// @details Each entry is a pointer to the parameter passed to the function; diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 3b99004820..b2823cf413 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -411,16 +411,36 @@ typedef ur_result_t(UR_APICALL *ur_pfnGetProgramProcAddrTable_t)( /////////////////////////////////////////////////////////////////////////////// /// @brief Function-pointer for urProgramBuildExp typedef ur_result_t(UR_APICALL *ur_pfnProgramBuildExp_t)( - ur_context_handle_t, ur_program_handle_t, uint32_t, ur_device_handle_t *, const char *); +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramCompileExp +typedef ur_result_t(UR_APICALL *ur_pfnProgramCompileExp_t)( + ur_program_handle_t, + uint32_t, + ur_device_handle_t *, + const char *); + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Function-pointer for urProgramLinkExp +typedef ur_result_t(UR_APICALL *ur_pfnProgramLinkExp_t)( + ur_context_handle_t, + uint32_t, + ur_device_handle_t *, + uint32_t, + const ur_program_handle_t *, + const char *, + ur_program_handle_t *); + /////////////////////////////////////////////////////////////////////////////// /// @brief Table of ProgramExp functions pointers typedef struct ur_program_exp_dditable_t { ur_pfnProgramBuildExp_t pfnBuildExp; + ur_pfnProgramCompileExp_t pfnCompileExp; + ur_pfnProgramLinkExp_t pfnLinkExp; } ur_program_exp_dditable_t; /////////////////////////////////////////////////////////////////////////////// diff --git a/include/ur_print.hpp b/include/ur_print.hpp index b239f7dfeb..f779e95f2b 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -872,6 +872,12 @@ inline std::ostream &operator<<(std::ostream &os, ur_function_t value) { case UR_FUNCTION_PROGRAM_BUILD_EXP: os << "UR_FUNCTION_PROGRAM_BUILD_EXP"; break; + case UR_FUNCTION_PROGRAM_COMPILE_EXP: + os << "UR_FUNCTION_PROGRAM_COMPILE_EXP"; + break; + case UR_FUNCTION_PROGRAM_LINK_EXP: + os << "UR_FUNCTION_PROGRAM_LINK_EXP"; + break; case UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK: os << "UR_FUNCTION_LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK"; break; @@ -9996,12 +10002,6 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct /// std::ostream & inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_build_exp_params_t *params) { - os << ".hContext = "; - - details::printPtr(os, - *(params->phContext)); - - os << ", "; os << ".hProgram = "; details::printPtr(os, @@ -10059,6 +10059,43 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct return os; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_compile_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_compile_exp_params_t *params) { + + os << ".hProgram = "; + + details::printPtr(os, + *(params->phProgram)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = {"; + for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphDevices))[i]); + } + os << "}"; + + os << ", "; + os << ".pOptions = "; + + details::printPtr(os, + *(params->ppOptions)); + + return os; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_program_link_params_t type /// @returns @@ -10102,6 +10139,66 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct return os; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Print operator for the ur_program_link_exp_params_t type +/// @returns +/// std::ostream & +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_link_exp_params_t *params) { + + os << ".hContext = "; + + details::printPtr(os, + *(params->phContext)); + + os << ", "; + os << ".numDevices = "; + + os << *(params->pnumDevices); + + os << ", "; + os << ".phDevices = {"; + for (size_t i = 0; *(params->pphDevices) != NULL && i < *params->pnumDevices; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphDevices))[i]); + } + os << "}"; + + os << ", "; + os << ".count = "; + + os << *(params->pcount); + + os << ", "; + os << ".phPrograms = {"; + for (size_t i = 0; *(params->pphPrograms) != NULL && i < *params->pcount; ++i) { + if (i != 0) { + os << ", "; + } + + details::printPtr(os, + (*(params->pphPrograms))[i]); + } + os << "}"; + + os << ", "; + os << ".pOptions = "; + + details::printPtr(os, + *(params->ppOptions)); + + os << ", "; + os << ".phProgram = "; + + details::printPtr(os, + *(params->pphProgram)); + + return os; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_program_retain_params_t type /// @returns @@ -15882,9 +15979,15 @@ UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, case UR_FUNCTION_PROGRAM_COMPILE: { os << (const struct ur_program_compile_params_t *)params; } break; + case UR_FUNCTION_PROGRAM_COMPILE_EXP: { + os << (const struct ur_program_compile_exp_params_t *)params; + } break; case UR_FUNCTION_PROGRAM_LINK: { os << (const struct ur_program_link_params_t *)params; } break; + case UR_FUNCTION_PROGRAM_LINK_EXP: { + os << (const struct ur_program_link_exp_params_t *)params; + } break; case UR_FUNCTION_PROGRAM_RETAIN: { os << (const struct ur_program_retain_params_t *)params; } break; diff --git a/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst b/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst new file mode 100644 index 0000000000..d4c2a6cb7a --- /dev/null +++ b/scripts/core/EXP-MULTI-DEVICE-COMPILE.rst @@ -0,0 +1,64 @@ +<% + OneApi=tags['$OneApi'] + x=tags['$x'] + X=x.upper() +%> + +.. _experimental-multi-device-compile: + +================================================================================ +Multi Device Compile +================================================================================ + +.. warning:: + + Experimental features: + + * May be replaced, updated, or removed at any time. + * Do not require maintaining API/ABI stability of their own additions over + time. + * Do not require conformance testing of their own additions. + + + +Motivation +-------------------------------------------------------------------------------- + +Instead of relying on the list of devices used to create a context, provide +interfaces which instead take a list of devices. This more closely aligns with +PI and OpenCL. Introduced to workaround a regression. May be superseded in +future. + +API +-------------------------------------------------------------------------------- + +Functions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* ${x}ProgramBuildExp +* ${x}ProgramCompileExp +* ${x}ProgramLinkExp + +Changelog +-------------------------------------------------------------------------------- + ++-----------+------------------------+ +| Revision | Changes | ++===========+========================+ +| 1.0 | Initial Draft | ++-----------+------------------------+ + +Support +-------------------------------------------------------------------------------- + +Adapters which support this experimental feature *must* return the valid string +defined in ``${X}_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP`` +as one of the options from ${x}DeviceGetInfo when querying for +${X}_DEVICE_INFO_EXTENSIONS. Conversely, before using any of the +functionality defined in this experimental feature the user *must* use the +device query to determine if the adapter supports this feature. + +Contributors +-------------------------------------------------------------------------------- + +* Kenneth Benzie (Benie) `k.benzie@codeplay.com `_ diff --git a/scripts/core/exp-multi-device-compile.yml b/scripts/core/exp-multi-device-compile.yml new file mode 100644 index 0000000000..b51f938f7e --- /dev/null +++ b/scripts/core/exp-multi-device-compile.yml @@ -0,0 +1,125 @@ +# +# Copyright (C) 2023 Intel Corporation +# +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# See YaML.md for syntax definition +# +--- #-------------------------------------------------------------------------- +type: header +desc: "Intel $OneApi Unified Runtime Experimental APIs for multi-device compile" +ordinal: "99" + +--- #-------------------------------------------------------------------------- +type: macro +desc: | + The extension string which defines support for test + which is returned when querying device extensions. +name: $X_MULTI_DEVICE_COMPILE_EXTENSION_STRING_EXP +value: "\"$x_exp_multi_device_compile\"" + +--- #-------------------------------------------------------------------------- +type: function +desc: "Produces an executable program from one program, negates need for the linking step." +class: $xProgram +name: BuildExp +ordinal: "2" +decl: static +analogue: + - "**clBuildProgram**" +details: + - "The application may call this function from simultaneous threads." + - "Following a successful call to this entry point, the program passed will contain a binary of the $X_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in `phDevices`." +params: + - type: $x_program_handle_t + name: hProgram + desc: "[in] Handle of the program to build." + - type: uint32_t + name: numDevices + desc: "[in] number of devices" + - type: $x_device_handle_t* + name: phDevices + desc: "[in][range(0, numDevices)] pointer to array of device handles" + - type: const char* + name: pOptions + desc: "[in][optional] pointer to build options null-terminated string." +returns: + - $X_RESULT_ERROR_INVALID_PROGRAM: + - "If `hProgram` isn't a valid program object." + - $X_RESULT_ERROR_PROGRAM_BUILD_FAILURE: + - "If an error occurred when building `hProgram`." + +--- #-------------------------------------------------------------------------- +type: function +desc: "Produces an executable program from one or more programs." +class: $xProgram +name: CompileExp +decl: static +ordinal: "3" +analogue: + - "**clCompileProgram**" +details: + - "The application may call this function from simultaneous threads." + - "Following a successful call to this entry point `hProgram` will contain a binary of the $X_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type for each device in `phDevices`." +params: + - type: $x_program_handle_t + name: hProgram + desc: "[in][out] handle of the program to compile." + - type: uint32_t + name: numDevices + desc: "[in] number of devices" + - type: $x_device_handle_t* + name: phDevices + desc: "[in][range(0, numDevices)] pointer to array of device handles" + - type: const char* + name: pOptions + desc: "[in][optional] pointer to build options null-terminated string." +returns: + - $X_RESULT_ERROR_INVALID_PROGRAM: + - "If `hProgram` isn't a valid program object." + - $X_RESULT_ERROR_PROGRAM_BUILD_FAILURE: + - "If an error occurred while compiling `hProgram`." + +--- #-------------------------------------------------------------------------- +type: function +desc: "Produces an executable program from one or more programs." +class: $xProgram +name: LinkExp +decl: static +ordinal: "4" +analogue: + - "**clLinkProgram**" +details: + - "The application may call this function from simultaneous threads." + - "Following a successful call to this entry point the program returned in `phProgram` will contain a binary of the $X_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in `phDevices`." +params: + - type: $x_context_handle_t + name: hContext + desc: "[in] handle of the context instance." + - type: uint32_t + name: numDevices + desc: "[in] number of devices" + - type: $x_device_handle_t* + name: phDevices + desc: "[in][range(0, numDevices)] pointer to array of device handles" + - type: uint32_t + name: count + desc: "[in] number of program handles in `phPrograms`." + - type: const $x_program_handle_t* + name: phPrograms + desc: "[in][range(0, count)] pointer to array of program handles." + - type: const char* + name: pOptions + desc: "[in][optional] pointer to linker options null-terminated string." + - type: $x_program_handle_t* + name: phProgram + desc: "[out] pointer to handle of program object created." +returns: + - $X_RESULT_ERROR_INVALID_PROGRAM: + - "If one of the programs in `phPrograms` isn't a valid program object." + - $X_RESULT_ERROR_INVALID_SIZE: + - "`count == 0`" + - $X_RESULT_ERROR_PROGRAM_LINK_FAILURE: + - "If an error occurred while linking `phPrograms`." diff --git a/scripts/core/program.yml b/scripts/core/program.yml index 4886cb83cc..acab24c3bd 100644 --- a/scripts/core/program.yml +++ b/scripts/core/program.yml @@ -182,39 +182,6 @@ returns: - "If an error occurred when building `hProgram`." --- #-------------------------------------------------------------------------- type: function -desc: "Produces an executable program from one program, negates need for the linking step." -class: $xProgram -name: BuildExp -ordinal: "2" -decl: static -analogue: - - "**clBuildProgram**" -details: - - "The application may call this function from simultaneous threads." - - "Following a successful call to this entry point, the program passed will contain a binary of the $X_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in `hContext`." -params: - - type: $x_context_handle_t - name: hContext - desc: "[in] handle of the context instance." - - type: $x_program_handle_t - name: hProgram - desc: "[in] Handle of the program to build." - - type: uint32_t - name: numDevices - desc: "[in] number of devices" - - type: $x_device_handle_t* - name: phDevices - desc: "[in][range(0, numDevices)] pointer to array of device handles" - - type: const char* - name: pOptions - desc: "[in][optional] pointer to build options null-terminated string." -returns: - - $X_RESULT_ERROR_INVALID_PROGRAM: - - "If `hProgram` isn't a valid program object." - - $X_RESULT_ERROR_PROGRAM_BUILD_FAILURE: - - "If an error occurred when building `hProgram`." ---- #-------------------------------------------------------------------------- -type: function desc: "Produces an executable program from one or more programs." class: $xProgram name: Compile diff --git a/scripts/core/registry.yml b/scripts/core/registry.yml index 6c292b126c..e5234a59af 100644 --- a/scripts/core/registry.yml +++ b/scripts/core/registry.yml @@ -550,9 +550,15 @@ etors: - name: PROGRAM_BUILD_EXP desc: Enumerator for $xProgramBuildExp value: '197' +- name: PROGRAM_COMPILE_EXP + desc: Enumerator for $xProgramCompileExp + value: '198' +- name: PROGRAM_LINK_EXP + desc: Enumerator for $xProgramLinkExp + value: '199' - name: LOADER_CONFIG_SET_CODE_LOCATION_CALLBACK desc: Enumerator for $xLoaderConfigSetCodeLocationCallback - value: '198' + value: '200' --- type: enum desc: Defines structure types diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index bffc67e7f9..a4e91e3dc0 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -1749,33 +1749,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return exceptionToResult(std::current_exception()); } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urProgramBuildExp -__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t * - phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char * - pOptions ///< [in][optional] pointer to build options null-terminated string. - ) try { - ur_result_t result = UR_RESULT_SUCCESS; - - // if the driver has created a custom function, then call it instead of using the generic path - auto pfnBuildExp = d_context.urDdiTable.ProgramExp.pfnBuildExp; - if (nullptr != pfnBuildExp) { - result = - pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); - } else { - // generic implementation - } - - return result; -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -5096,6 +5069,89 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnBuildExp = d_context.urDdiTable.ProgramExp.pfnBuildExp; + if (nullptr != pfnBuildExp) { + result = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramCompileExp +__urdlllocal ur_result_t UR_APICALL urProgramCompileExp( + ur_program_handle_t + hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnCompileExp = d_context.urDdiTable.ProgramExp.pfnCompileExp; + if (nullptr != pfnCompileExp) { + result = pfnCompileExp(hProgram, numDevices, phDevices, pOptions); + } else { + // generic implementation + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramLinkExp +__urdlllocal ur_result_t UR_APICALL urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t * + phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char * + pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t + *phProgram ///< [out] pointer to handle of program object created. + ) try { + ur_result_t result = UR_RESULT_SUCCESS; + + // if the driver has created a custom function, then call it instead of using the generic path + auto pfnLinkExp = d_context.urDdiTable.ProgramExp.pfnLinkExp; + if (nullptr != pfnLinkExp) { + result = pfnLinkExp(hContext, numDevices, phDevices, count, phPrograms, + pOptions, phProgram); + } else { + // generic implementation + *phProgram = reinterpret_cast(d_context.get()); + } + + return result; +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -5905,6 +5961,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( pDdiTable->pfnBuildExp = driver::urProgramBuildExp; + pDdiTable->pfnCompileExp = driver::urProgramCompileExp; + + pDdiTable->pfnLinkExp = driver::urProgramLinkExp; + return result; } catch (...) { return exceptionToResult(std::current_exception()); diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index ca533030e8..d33a3aaf51 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -1982,37 +1982,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urProgramBuildExp -__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t * - phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char * - pOptions ///< [in][optional] pointer to build options null-terminated string. -) { - auto pfnBuildExp = context.urDdiTable.ProgramExp.pfnBuildExp; - - if (nullptr == pfnBuildExp) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - } - - ur_program_build_exp_params_t params = {&hContext, &hProgram, &numDevices, - &phDevices, &pOptions}; - uint64_t instance = context.notify_begin(UR_FUNCTION_PROGRAM_BUILD_EXP, - "urProgramBuildExp", ¶ms); - - ur_result_t result = - pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); - - context.notify_end(UR_FUNCTION_PROGRAM_BUILD_EXP, "urProgramBuildExp", - ¶ms, &result, instance); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -5909,6 +5878,102 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + auto pfnBuildExp = context.urDdiTable.ProgramExp.pfnBuildExp; + + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_program_build_exp_params_t params = {&hProgram, &numDevices, &phDevices, + &pOptions}; + uint64_t instance = context.notify_begin(UR_FUNCTION_PROGRAM_BUILD_EXP, + "urProgramBuildExp", ¶ms); + + ur_result_t result = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); + + context.notify_end(UR_FUNCTION_PROGRAM_BUILD_EXP, "urProgramBuildExp", + ¶ms, &result, instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramCompileExp +__urdlllocal ur_result_t UR_APICALL urProgramCompileExp( + ur_program_handle_t + hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + auto pfnCompileExp = context.urDdiTable.ProgramExp.pfnCompileExp; + + if (nullptr == pfnCompileExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_program_compile_exp_params_t params = {&hProgram, &numDevices, + &phDevices, &pOptions}; + uint64_t instance = context.notify_begin(UR_FUNCTION_PROGRAM_COMPILE_EXP, + "urProgramCompileExp", ¶ms); + + ur_result_t result = + pfnCompileExp(hProgram, numDevices, phDevices, pOptions); + + context.notify_end(UR_FUNCTION_PROGRAM_COMPILE_EXP, "urProgramCompileExp", + ¶ms, &result, instance); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramLinkExp +__urdlllocal ur_result_t UR_APICALL urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t * + phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char * + pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t + *phProgram ///< [out] pointer to handle of program object created. +) { + auto pfnLinkExp = context.urDdiTable.ProgramExp.pfnLinkExp; + + if (nullptr == pfnLinkExp) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + + ur_program_link_exp_params_t params = {&hContext, &numDevices, &phDevices, + &count, &phPrograms, &pOptions, + &phProgram}; + uint64_t instance = context.notify_begin(UR_FUNCTION_PROGRAM_LINK_EXP, + "urProgramLinkExp", ¶ms); + + ur_result_t result = pfnLinkExp(hContext, numDevices, phDevices, count, + phPrograms, pOptions, phProgram); + + context.notify_end(UR_FUNCTION_PROGRAM_LINK_EXP, "urProgramLinkExp", + ¶ms, &result, instance); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -6929,6 +6994,12 @@ __urdlllocal ur_result_t UR_APICALL urGetProgramExpProcAddrTable( dditable.pfnBuildExp = pDdiTable->pfnBuildExp; pDdiTable->pfnBuildExp = ur_tracing_layer::urProgramBuildExp; + dditable.pfnCompileExp = pDdiTable->pfnCompileExp; + pDdiTable->pfnCompileExp = ur_tracing_layer::urProgramCompileExp; + + dditable.pfnLinkExp = pDdiTable->pfnLinkExp; + pDdiTable->pfnLinkExp = ur_tracing_layer::urProgramLinkExp; + return result; } /////////////////////////////////////////////////////////////////////////////// diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index 843d5b62ee..a307bb37de 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -2476,43 +2476,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urProgramBuildExp -__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t * - phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char * - pOptions ///< [in][optional] pointer to build options null-terminated string. -) { - auto pfnBuildExp = context.urDdiTable.ProgramExp.pfnBuildExp; - - if (nullptr == pfnBuildExp) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - if (context.enableParameterValidation) { - if (NULL == hContext) { - return UR_RESULT_ERROR_INVALID_NULL_HANDLE; - } - - if (NULL == hProgram) { - return UR_RESULT_ERROR_INVALID_NULL_HANDLE; - } - - if (NULL == phDevices) { - return UR_RESULT_ERROR_INVALID_NULL_POINTER; - } - } - - ur_result_t result = - pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -7629,6 +7592,119 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + auto pfnBuildExp = context.urDdiTable.ProgramExp.pfnBuildExp; + + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hProgram) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == phDevices) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + } + + ur_result_t result = pfnBuildExp(hProgram, numDevices, phDevices, pOptions); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramCompileExp +__urdlllocal ur_result_t UR_APICALL urProgramCompileExp( + ur_program_handle_t + hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + auto pfnCompileExp = context.urDdiTable.ProgramExp.pfnCompileExp; + + if (nullptr == pfnCompileExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hProgram) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == phDevices) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + } + + ur_result_t result = + pfnCompileExp(hProgram, numDevices, phDevices, pOptions); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramLinkExp +__urdlllocal ur_result_t UR_APICALL urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t * + phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char * + pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t + *phProgram ///< [out] pointer to handle of program object created. +) { + auto pfnLinkExp = context.urDdiTable.ProgramExp.pfnLinkExp; + + if (nullptr == pfnLinkExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + if (context.enableParameterValidation) { + if (NULL == hContext) { + return UR_RESULT_ERROR_INVALID_NULL_HANDLE; + } + + if (NULL == phDevices) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (NULL == phPrograms) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (NULL == phProgram) { + return UR_RESULT_ERROR_INVALID_NULL_POINTER; + } + + if (count == 0) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + } + + ur_result_t result = pfnLinkExp(hContext, numDevices, phDevices, count, + phPrograms, pOptions, phProgram); + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -8696,6 +8772,12 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( dditable.pfnBuildExp = pDdiTable->pfnBuildExp; pDdiTable->pfnBuildExp = ur_validation_layer::urProgramBuildExp; + dditable.pfnCompileExp = pDdiTable->pfnCompileExp; + pDdiTable->pfnCompileExp = ur_validation_layer::urProgramCompileExp; + + dditable.pfnLinkExp = pDdiTable->pfnLinkExp; + pDdiTable->pfnLinkExp = ur_validation_layer::urProgramLinkExp; + return result; } diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 194797bd14..9327f349c5 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -2311,46 +2311,6 @@ __urdlllocal ur_result_t UR_APICALL urProgramBuild( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Intercept function for urProgramBuildExp -__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t * - phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char * - pOptions ///< [in][optional] pointer to build options null-terminated string. -) { - ur_result_t result = UR_RESULT_SUCCESS; - - // extract platform's function pointer table - auto dditable = reinterpret_cast(hContext)->dditable; - auto pfnBuildExp = dditable->ur.ProgramExp.pfnBuildExp; - if (nullptr == pfnBuildExp) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - // convert loader handle to platform handle - hContext = reinterpret_cast(hContext)->handle; - - // convert loader handle to platform handle - hProgram = reinterpret_cast(hProgram)->handle; - - // convert loader handles to platform handles - auto phDevicesLocal = std::vector(numDevices); - for (size_t i = 0; i < numDevices; ++i) { - phDevicesLocal[i] = - reinterpret_cast(phDevices[i])->handle; - } - - // forward to device-platform - result = pfnBuildExp(hContext, hProgram, numDevices, phDevicesLocal.data(), - pOptions); - - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urProgramCompile __urdlllocal ur_result_t UR_APICALL urProgramCompile( @@ -7071,6 +7031,138 @@ __urdlllocal ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramBuildExp +__urdlllocal ur_result_t UR_APICALL urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hProgram)->dditable; + auto pfnBuildExp = dditable->ur.ProgramExp.pfnBuildExp; + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hProgram = reinterpret_cast(hProgram)->handle; + + // convert loader handles to platform handles + auto phDevicesLocal = std::vector(numDevices); + for (size_t i = 0; i < numDevices; ++i) { + phDevicesLocal[i] = + reinterpret_cast(phDevices[i])->handle; + } + + // forward to device-platform + result = pfnBuildExp(hProgram, numDevices, phDevicesLocal.data(), pOptions); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramCompileExp +__urdlllocal ur_result_t UR_APICALL urProgramCompileExp( + ur_program_handle_t + hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hProgram)->dditable; + auto pfnCompileExp = dditable->ur.ProgramExp.pfnCompileExp; + if (nullptr == pfnCompileExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hProgram = reinterpret_cast(hProgram)->handle; + + // convert loader handles to platform handles + auto phDevicesLocal = std::vector(numDevices); + for (size_t i = 0; i < numDevices; ++i) { + phDevicesLocal[i] = + reinterpret_cast(phDevices[i])->handle; + } + + // forward to device-platform + result = + pfnCompileExp(hProgram, numDevices, phDevicesLocal.data(), pOptions); + + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Intercept function for urProgramLinkExp +__urdlllocal ur_result_t UR_APICALL urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t * + phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char * + pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t + *phProgram ///< [out] pointer to handle of program object created. +) { + ur_result_t result = UR_RESULT_SUCCESS; + + // extract platform's function pointer table + auto dditable = reinterpret_cast(hContext)->dditable; + auto pfnLinkExp = dditable->ur.ProgramExp.pfnLinkExp; + if (nullptr == pfnLinkExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + // convert loader handle to platform handle + hContext = reinterpret_cast(hContext)->handle; + + // convert loader handles to platform handles + auto phDevicesLocal = std::vector(numDevices); + for (size_t i = 0; i < numDevices; ++i) { + phDevicesLocal[i] = + reinterpret_cast(phDevices[i])->handle; + } + + // convert loader handles to platform handles + auto phProgramsLocal = std::vector(count); + for (size_t i = 0; i < count; ++i) { + phProgramsLocal[i] = + reinterpret_cast(phPrograms[i])->handle; + } + + // forward to device-platform + result = pfnLinkExp(hContext, numDevices, phDevicesLocal.data(), count, + phProgramsLocal.data(), pOptions, phProgram); + + if (UR_RESULT_SUCCESS != result) { + return result; + } + + try { + // convert platform handle to loader handle + *phProgram = reinterpret_cast( + ur_program_factory.getInstance(*phProgram, dditable)); + } catch (std::bad_alloc &) { + result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urUSMImportExp __urdlllocal ur_result_t UR_APICALL urUSMImportExp( @@ -8138,6 +8230,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( ur_loader::context->forceIntercept) { // return pointers to loader's DDIs pDdiTable->pfnBuildExp = ur_loader::urProgramBuildExp; + pDdiTable->pfnCompileExp = ur_loader::urProgramCompileExp; + pDdiTable->pfnLinkExp = ur_loader::urProgramLinkExp; } else { // return pointers directly to platform's DDIs *pDdiTable = diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index 6c7fcb6f2b..de9e029536 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -2968,53 +2968,6 @@ ur_result_t UR_APICALL urProgramBuild( return exceptionToResult(std::current_exception()); } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Produces an executable program from one program, negates need for the -/// linking step. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - Following a successful call to this entry point, the program passed -/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type -/// for each device in `hContext`. -/// -/// @remarks -/// _Analogues_ -/// - **clBuildProgram** -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hContext` -/// + `NULL == hProgram` -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == phDevices` -/// - ::UR_RESULT_ERROR_INVALID_PROGRAM -/// + If `hProgram` isn't a valid program object. -/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE -/// + If an error occurred when building `hProgram`. -ur_result_t UR_APICALL urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t * - phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char * - pOptions ///< [in][optional] pointer to build options null-terminated string. - ) try { - auto pfnBuildExp = ur_lib::context->urDdiTable.ProgramExp.pfnBuildExp; - if (nullptr == pfnBuildExp) { - return UR_RESULT_ERROR_UNINITIALIZED; - } - - return pfnBuildExp(hContext, hProgram, numDevices, phDevices, pOptions); -} catch (...) { - return exceptionToResult(std::current_exception()); -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one or more programs. /// @@ -7952,6 +7905,151 @@ ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( return exceptionToResult(std::current_exception()); } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +ur_result_t UR_APICALL urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. + ) try { + auto pfnBuildExp = ur_lib::context->urDdiTable.ProgramExp.pfnBuildExp; + if (nullptr == pfnBuildExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnBuildExp(hProgram, numDevices, phDevices, pOptions); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point `hProgram` will +/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clCompileProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred while compiling `hProgram`. +ur_result_t UR_APICALL urProgramCompileExp( + ur_program_handle_t + hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. + ) try { + auto pfnCompileExp = ur_lib::context->urDdiTable.ProgramExp.pfnCompileExp; + if (nullptr == pfnCompileExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnCompileExp(hProgram, numDevices, phDevices, pOptions); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point the program returned +/// in `phProgram` will contain a binary of the +/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in +/// `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clLinkProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// + `NULL == phPrograms` +/// + `NULL == phProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If one of the programs in `phPrograms` isn't a valid program object. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE +/// + If an error occurred while linking `phPrograms`. +ur_result_t UR_APICALL urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t * + phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char * + pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t + *phProgram ///< [out] pointer to handle of program object created. + ) try { + auto pfnLinkExp = ur_lib::context->urDdiTable.ProgramExp.pfnLinkExp; + if (nullptr == pfnLinkExp) { + return UR_RESULT_ERROR_UNINITIALIZED; + } + + return pfnLinkExp(hContext, numDevices, phDevices, count, phPrograms, + pOptions, phProgram); +} catch (...) { + return exceptionToResult(std::current_exception()); +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Import memory into USM /// diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 87ad442429..85cc45d246 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -2519,47 +2519,6 @@ ur_result_t UR_APICALL urProgramBuild( return result; } -/////////////////////////////////////////////////////////////////////////////// -/// @brief Produces an executable program from one program, negates need for the -/// linking step. -/// -/// @details -/// - The application may call this function from simultaneous threads. -/// - Following a successful call to this entry point, the program passed -/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type -/// for each device in `hContext`. -/// -/// @remarks -/// _Analogues_ -/// - **clBuildProgram** -/// -/// @returns -/// - ::UR_RESULT_SUCCESS -/// - ::UR_RESULT_ERROR_UNINITIALIZED -/// - ::UR_RESULT_ERROR_DEVICE_LOST -/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC -/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE -/// + `NULL == hContext` -/// + `NULL == hProgram` -/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == phDevices` -/// - ::UR_RESULT_ERROR_INVALID_PROGRAM -/// + If `hProgram` isn't a valid program object. -/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE -/// + If an error occurred when building `hProgram`. -ur_result_t UR_APICALL urProgramBuildExp( - ur_context_handle_t hContext, ///< [in] handle of the context instance. - ur_program_handle_t hProgram, ///< [in] Handle of the program to build. - uint32_t numDevices, ///< [in] number of devices - ur_device_handle_t * - phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles - const char * - pOptions ///< [in][optional] pointer to build options null-terminated string. -) { - ur_result_t result = UR_RESULT_SUCCESS; - return result; -} - /////////////////////////////////////////////////////////////////////////////// /// @brief Produces an executable program from one or more programs. /// @@ -6714,6 +6673,132 @@ ur_result_t UR_APICALL urKernelSuggestMaxCooperativeGroupCountExp( return result; } +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one program, negates need for the +/// linking step. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point, the program passed +/// will contain a binary of the ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clBuildProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred when building `hProgram`. +ur_result_t UR_APICALL urProgramBuildExp( + ur_program_handle_t hProgram, ///< [in] Handle of the program to build. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point `hProgram` will +/// contain a binary of the ::UR_PROGRAM_BINARY_TYPE_COMPILED_OBJECT type +/// for each device in `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clCompileProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hProgram` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If `hProgram` isn't a valid program object. +/// - ::UR_RESULT_ERROR_PROGRAM_BUILD_FAILURE +/// + If an error occurred while compiling `hProgram`. +ur_result_t UR_APICALL urProgramCompileExp( + ur_program_handle_t + hProgram, ///< [in][out] handle of the program to compile. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + const char * + pOptions ///< [in][optional] pointer to build options null-terminated string. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + +/////////////////////////////////////////////////////////////////////////////// +/// @brief Produces an executable program from one or more programs. +/// +/// @details +/// - The application may call this function from simultaneous threads. +/// - Following a successful call to this entry point the program returned +/// in `phProgram` will contain a binary of the +/// ::UR_PROGRAM_BINARY_TYPE_EXECUTABLE type for each device in +/// `phDevices`. +/// +/// @remarks +/// _Analogues_ +/// - **clLinkProgram** +/// +/// @returns +/// - ::UR_RESULT_SUCCESS +/// - ::UR_RESULT_ERROR_UNINITIALIZED +/// - ::UR_RESULT_ERROR_DEVICE_LOST +/// - ::UR_RESULT_ERROR_ADAPTER_SPECIFIC +/// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE +/// + `NULL == hContext` +/// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER +/// + `NULL == phDevices` +/// + `NULL == phPrograms` +/// + `NULL == phProgram` +/// - ::UR_RESULT_ERROR_INVALID_PROGRAM +/// + If one of the programs in `phPrograms` isn't a valid program object. +/// - ::UR_RESULT_ERROR_INVALID_SIZE +/// + `count == 0` +/// - ::UR_RESULT_ERROR_PROGRAM_LINK_FAILURE +/// + If an error occurred while linking `phPrograms`. +ur_result_t UR_APICALL urProgramLinkExp( + ur_context_handle_t hContext, ///< [in] handle of the context instance. + uint32_t numDevices, ///< [in] number of devices + ur_device_handle_t * + phDevices, ///< [in][range(0, numDevices)] pointer to array of device handles + uint32_t count, ///< [in] number of program handles in `phPrograms`. + const ur_program_handle_t * + phPrograms, ///< [in][range(0, count)] pointer to array of program handles. + const char * + pOptions, ///< [in][optional] pointer to linker options null-terminated string. + ur_program_handle_t + *phProgram ///< [out] pointer to handle of program object created. +) { + ur_result_t result = UR_RESULT_SUCCESS; + return result; +} + /////////////////////////////////////////////////////////////////////////////// /// @brief Import memory into USM /// From b42649f242000d281c5789389deab5343641eb21 Mon Sep 17 00:00:00 2001 From: Omar Ahmed <30423288+omarahmed1111@users.noreply.github.com> Date: Mon, 30 Oct 2023 14:54:05 +0000 Subject: [PATCH 076/145] Revert "Revert "Bump adapters branch"" --- CMakeLists.txt | 2 +- cmake/helpers.cmake | 2 +- include/ur.py | 5 +- include/ur_api.h | 5 +- include/ur_ddi.h | 2 +- scripts/Doxyfile | 2 +- scripts/ci.py | 80 ---- scripts/core/INTRO.rst | 9 + scripts/core/platform.yml | 3 + scripts/parse_specs.py | 4 +- scripts/templates/params.hpp.mako | 26 +- source/common/CMakeLists.txt | 35 +- source/common/linux/ur_lib_loader.cpp | 24 +- source/common/ur_params.hpp | 407 +++++++++--------- source/loader/ur_adapter_registry.hpp | 7 +- source/ur_api.cpp | 2 +- .../context/context_adapter_level_zero.match | 3 - .../urContextCreateWithNativeHandle.cpp | 2 +- test/loader/loader_config/CMakeLists.txt | 2 +- 19 files changed, 285 insertions(+), 337 deletions(-) delete mode 100644 scripts/ci.py diff --git a/CMakeLists.txt b/CMakeLists.txt index 1210375dd8..990d35190e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR) -project(unified-runtime VERSION 0.7.0) +project(unified-runtime VERSION 0.8.0) include(GNUInstallDirs) include(CheckCXXSourceCompiles) diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake index 3c90d41236..eb1bb48c00 100644 --- a/cmake/helpers.cmake +++ b/cmake/helpers.cmake @@ -78,7 +78,7 @@ function(add_ur_target_compile_options name) endif() elseif(MSVC) target_compile_options(${name} PRIVATE - /MP + $<$:/MP> # clang-cl.exe does not support /MP /W3 /MD$<$:d> /GS diff --git a/include/ur.py b/include/ur.py index 2b49088119..f606ce4127 100644 --- a/include/ur.py +++ b/include/ur.py @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @file ur.py - @version v0.7-r0 + @version v0.8-r0 """ import platform @@ -570,7 +570,8 @@ def __str__(self): class ur_api_version_v(IntEnum): _0_6 = UR_MAKE_VERSION( 0, 6 ) ## version 0.6 _0_7 = UR_MAKE_VERSION( 0, 7 ) ## version 0.7 - CURRENT = UR_MAKE_VERSION( 0, 7 ) ## latest known version + _0_8 = UR_MAKE_VERSION( 0, 8 ) ## version 0.8 + CURRENT = UR_MAKE_VERSION( 0, 8 ) ## latest known version class ur_api_version_t(c_int): def __str__(self): diff --git a/include/ur_api.h b/include/ur_api.h index 677c31005f..c9f29a1535 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_api.h - * @version v0.7-r0 + * @version v0.8-r0 * */ #ifndef UR_API_H_INCLUDED @@ -1022,7 +1022,8 @@ urPlatformGetInfo( typedef enum ur_api_version_t { UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), ///< version 0.6 UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), ///< version 0.7 - UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 7), ///< latest known version + UR_API_VERSION_0_8 = UR_MAKE_VERSION(0, 8), ///< version 0.8 + UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 8), ///< latest known version /// @cond UR_API_VERSION_FORCE_UINT32 = 0x7fffffff /// @endcond diff --git a/include/ur_ddi.h b/include/ur_ddi.h index a0c2a5012d..a61cbee653 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_ddi.h - * @version v0.7-r0 + * @version v0.8-r0 * */ #ifndef UR_DDI_H_INCLUDED diff --git a/scripts/Doxyfile b/scripts/Doxyfile index c038d5276d..0134f27418 100644 --- a/scripts/Doxyfile +++ b/scripts/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "Intel One API Unified Runtime API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v0.7 +PROJECT_NUMBER = v0.8 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/scripts/ci.py b/scripts/ci.py deleted file mode 100644 index 05a9141248..0000000000 --- a/scripts/ci.py +++ /dev/null @@ -1,80 +0,0 @@ -import os -import sys -import argparse -import re -import fileinput -from distutils import dir_util -import util - -script_dir = os.path.dirname(os.path.abspath(__file__)) -root_dir = os.path.dirname(script_dir) - - -""" -Entry-point: - publishes HTML for GitLab pages -""" -def publish_gitlab_html(): - src_html_dir = os.path.join(root_dir, "docs", "html") - src_img_dir = os.path.join(root_dir, "images") - tmp_dir = os.path.join(root_dir, ".public") - tmp_img_dir = os.path.join(root_dir, ".public/images") - publishing_dir = os.path.join(root_dir, "public") - - # Remove dest dirs - if os.path.exists(tmp_dir): - print("Deleting temp dir: %s" % tmp_dir) - util.removePath(tmp_dir) - if os.path.exists(publishing_dir): - print("Deleting publishing dir: %s" % publishing_dir) - util.removePath(publishing_dir) - - # Copy over generated content to new folder - print("Copying html files from '%s' to '%s'" % (src_html_dir, tmp_dir)) - dir_util.copy_tree(src_html_dir, tmp_dir) - - # Fixes html files by converting paths relative to root html folder instead of repo - print("Fixing paths in html files in '%s' to be relative to root..." % (tmp_dir)) - regex_pattern = re.compile(r'\.\.[\/|\\]images') - files = util.findFiles(tmp_dir, "*.html") - print("Found %s files" % (len(files))) - with fileinput.FileInput(files=files, inplace=True) as f: - for line in f: - print(re.sub(regex_pattern, './images', line), end='') - - # Publish new folder to GitLab Pages folder (/public) - print("Publishing to GitLab pages by renaming '%s' to '%s'" % (tmp_dir, publishing_dir)) - os.rename(tmp_dir, publishing_dir) - - -""" -Entry-point: - main() -""" -def main(args=sys.argv[1:]): - # Define args - parser = argparse.ArgumentParser() - parser.add_argument( - "--publish-html", - help="Publish html", - action="store_true") - - # Parse args - options = parser.parse_args(args) - - # Publish GitLab html - if options.publish_html: - try: - publish_gitlab_html() - except Exception as e: - print(e) - print("Failed") - return 1 - - print("Done") - return 0 - - -if __name__ == '__main__': - sys.exit(main()) -# END OF FILE diff --git a/scripts/core/INTRO.rst b/scripts/core/INTRO.rst index 4c3a1a9d2d..8b9938cfb2 100644 --- a/scripts/core/INTRO.rst +++ b/scripts/core/INTRO.rst @@ -296,6 +296,15 @@ Specific environment variables can be set to control the behavior of unified run This environment variable is ignored when :envvar:`UR_ADAPTERS_FORCE_LOAD` environment variable is used. +.. envvar:: UR_ADAPTERS_DEEP_BIND + + If set, the loader will use `RTLD_DEEPBIND` when opening adapter libraries. This might be useful if an adapter + requires a different version of a shared library compared to the rest of the applcation. + + .. note:: + + This environment variable is Linux-only. + .. envvar:: UR_ENABLE_LAYERS Holds a comma-separated list of layers to enable in addition to any specified via ``urInit``. diff --git a/scripts/core/platform.yml b/scripts/core/platform.yml index f7020b4138..dbbbe312a9 100644 --- a/scripts/core/platform.yml +++ b/scripts/core/platform.yml @@ -133,6 +133,9 @@ etors: - name: "0_7" value: "$X_MAKE_VERSION( 0, 7 )" desc: "version 0.7" + - name: "0_8" + value: "$X_MAKE_VERSION( 0, 8 )" + desc: "version 0.8" --- #-------------------------------------------------------------------------- type: function desc: "Returns the API version supported by the specified platform" diff --git a/scripts/parse_specs.py b/scripts/parse_specs.py index 07ae086efd..414b25d8e0 100644 --- a/scripts/parse_specs.py +++ b/scripts/parse_specs.py @@ -18,8 +18,8 @@ import ctypes import itertools -default_version = "0.7" -all_versions = ["0.6", "0.7"] +default_version = "0.8" +all_versions = ["0.6", "0.7", "0.8"] """ preprocess object diff --git a/scripts/templates/params.hpp.mako b/scripts/templates/params.hpp.mako index 863c3d37ea..de971c481f 100644 --- a/scripts/templates/params.hpp.mako +++ b/scripts/templates/params.hpp.mako @@ -36,6 +36,8 @@ from templates import helper as th ${x}_params::serializePtr(os, ${caller.body()}); %elif th.type_traits.is_handle(itype): ${x}_params::serializePtr(os, ${caller.body()}); + %elif iname and iname.startswith("pfn"): + os << reinterpret_cast(${caller.body()}); %else: os << ${caller.body()}; %endif @@ -104,7 +106,7 @@ template <> struct is_handle<${th.make_type_name(n, tags, obj)}> : std::true_typ %endfor template inline constexpr bool is_handle_v = is_handle::value; -template inline void serializePtr(std::ostream &os, T *ptr); +template inline void serializePtr(std::ostream &os, const T *ptr); template inline void serializeFlag(std::ostream &os, uint32_t flag); template inline void serializeTagged(std::ostream &os, const void *ptr, T value, size_t size); @@ -192,7 +194,11 @@ template inline void serializeTagged(std::ostream &os, const void * case ${ename}: { %if th.value_traits.is_array(vtype): <% atype = th.value_traits.get_array_name(vtype) %> + %if 'void' in atype: + const ${atype} const *tptr = (const ${atype} const*)ptr; + %else: const ${atype} *tptr = (const ${atype} *)ptr; + %endif %if "char" in atype: ## print char* arrays as simple NULL-terminated strings serializePtr(os, tptr); %else: @@ -209,12 +215,16 @@ template inline void serializeTagged(std::ostream &os, const void * os << "}"; %endif %else: + %if 'void' in vtype: + const ${vtype} const *tptr = (const ${vtype} const *)ptr; + %else: const ${vtype} *tptr = (const ${vtype} *)ptr; + %endif if (sizeof(${vtype}) > size) { os << "invalid size (is: " << size << ", expected: >=" << sizeof(${vtype}) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; <%call expr="member(tptr, vtype, False)"> *tptr @@ -237,7 +247,7 @@ template inline void serializeTagged(std::ostream &os, const void * } ## structure type enum value must be first - enum ${th.make_enum_name(n, tags, obj)} *value = (enum ${th.make_enum_name(n, tags, obj)} *)ptr; + const enum ${th.make_enum_name(n, tags, obj)} *value = (const enum ${th.make_enum_name(n, tags, obj)} *)ptr; switch (*value) { %for n, item in enumerate(obj['etors']): <% @@ -362,21 +372,21 @@ inline std::ostream &operator<<(std::ostream &os, const struct ${th.make_pfncb_p namespace ${x}_params { -template inline void serializePtr(std::ostream &os, T *ptr) { +template inline void serializePtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; } else if constexpr (std::is_pointer_v) { - os << (void *)(ptr) << " ("; + os << (const void *)(ptr) << " ("; serializePtr(os, *ptr); os << ")"; } else if constexpr (std::is_void_v || is_handle_v) { - os << (void *)ptr; + os << (const void *)ptr; } else if constexpr (std::is_same_v, char>) { - os << (void *)(ptr) << " ("; + os << (const void *)(ptr) << " ("; os << ptr; os << ")"; } else { - os << (void *)(ptr) << " ("; + os << (const void *)(ptr) << " ("; os << *ptr; os << ")"; } diff --git a/source/common/CMakeLists.txt b/source/common/CMakeLists.txt index f240f9908b..5c6fb231da 100644 --- a/source/common/CMakeLists.txt +++ b/source/common/CMakeLists.txt @@ -3,28 +3,25 @@ # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -add_library(ur_common INTERFACE) +add_subdirectory(unified_malloc_framework) +add_subdirectory(umf_pools) + +add_ur_library(ur_common STATIC + umf_helpers.hpp + ur_pool_manager.hpp + $<$:windows/ur_lib_loader.cpp> + $<$:linux/ur_lib_loader.cpp> +) add_library(${PROJECT_NAME}::common ALIAS ur_common) -target_include_directories(ur_common INTERFACE +target_include_directories(ur_common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/include ) -add_subdirectory(unified_malloc_framework) -add_subdirectory(umf_pools) -target_link_libraries(ur_common INTERFACE unified_malloc_framework disjoint_pool ${CMAKE_DL_LIBS} ${PROJECT_NAME}::headers) - -if(WIN32) - target_sources(ur_common - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/windows/ur_lib_loader.cpp - umf_helpers.hpp ur_pool_manager.hpp - ) -else() - target_sources(ur_common - INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/linux/ur_lib_loader.cpp - umf_helpers.hpp ur_pool_manager.hpp - ) -endif() +target_link_libraries(ur_common PUBLIC + unified_malloc_framework + disjoint_pool + ${CMAKE_DL_LIBS} + ${PROJECT_NAME}::headers +) diff --git a/source/common/linux/ur_lib_loader.cpp b/source/common/linux/ur_lib_loader.cpp index 1c5e0af89b..d316e48b74 100644 --- a/source/common/linux/ur_lib_loader.cpp +++ b/source/common/linux/ur_lib_loader.cpp @@ -12,12 +12,7 @@ #include "logger/ur_logger.hpp" #include "ur_lib_loader.hpp" -#if defined(SANITIZER_ANY) || defined(__APPLE__) -#define LOAD_DRIVER_LIBRARY(NAME) dlopen(NAME, RTLD_LAZY | RTLD_LOCAL) -#else -#define LOAD_DRIVER_LIBRARY(NAME) \ - dlopen(NAME, RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND) -#endif +#define DEEP_BIND_ENV "UR_ADAPTERS_DEEP_BIND" namespace ur_loader { @@ -34,8 +29,21 @@ void LibLoader::freeAdapterLibrary(HMODULE handle) { std::unique_ptr LibLoader::loadAdapterLibrary(const char *name) { - return std::unique_ptr( - LOAD_DRIVER_LIBRARY(name)); + int mode = RTLD_LAZY | RTLD_LOCAL; +#if !defined(__APPLE__) + bool deepbind = getenv_tobool(DEEP_BIND_ENV); + if (deepbind) { +#if defined(SANITIZER_ANY) + logger::warning( + "Enabling RTLD_DEEPBIND while running under a sanitizer is likely " + "to cause issues. Consider disabling {} environment variable.", + DEEP_BIND_ENV); +#endif + mode |= RTLD_DEEPBIND; + } +#endif + + return std::unique_ptr(dlopen(name, mode)); } void *LibLoader::getFunctionPtr(HMODULE handle, const char *func_name) { diff --git a/source/common/ur_params.hpp b/source/common/ur_params.hpp index 4c1c90e993..76641dcb65 100644 --- a/source/common/ur_params.hpp +++ b/source/common/ur_params.hpp @@ -40,7 +40,7 @@ struct is_handle : std::true_type {}; template <> struct is_handle : std::true_type {}; template inline constexpr bool is_handle_v = is_handle::value; -template inline void serializePtr(std::ostream &os, T *ptr); +template inline void serializePtr(std::ostream &os, const T *ptr); template inline void serializeFlag(std::ostream &os, uint32_t flag); template @@ -1323,7 +1323,8 @@ inline void serializeStruct(std::ostream &os, const void *ptr) { return; } - enum ur_structure_type_t *value = (enum ur_structure_type_t *)ptr; + const enum ur_structure_type_t *value = + (const enum ur_structure_type_t *)ptr; switch (*value) { case UR_STRUCTURE_TYPE_CONTEXT_PROPERTIES: { @@ -2076,7 +2077,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2123,7 +2124,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_adapter_backend_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2137,7 +2138,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2263,7 +2264,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_platform_backend_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2945,7 +2946,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_device_type_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2959,7 +2960,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2973,7 +2974,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -2987,7 +2988,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3001,7 +3002,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3030,7 +3031,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3046,7 +3047,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3062,7 +3063,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3078,7 +3079,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3092,7 +3093,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3106,7 +3107,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3120,7 +3121,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3134,7 +3135,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3148,7 +3149,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3162,7 +3163,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3176,7 +3177,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3190,7 +3191,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3204,7 +3205,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3218,7 +3219,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3232,7 +3233,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3246,7 +3247,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3260,7 +3261,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3274,7 +3275,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3288,7 +3289,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3302,7 +3303,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3316,7 +3317,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3330,7 +3331,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3344,7 +3345,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3358,7 +3359,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3372,7 +3373,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3386,7 +3387,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3400,7 +3401,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3414,7 +3415,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3428,7 +3429,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3442,7 +3443,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3456,7 +3457,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3470,7 +3471,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3484,7 +3485,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3498,7 +3499,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3512,7 +3513,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3526,7 +3527,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3540,7 +3541,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3555,7 +3556,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_device_mem_cache_type_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3569,7 +3570,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3583,7 +3584,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3597,7 +3598,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3611,7 +3612,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3625,7 +3626,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3639,7 +3640,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3654,7 +3655,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_device_local_mem_type_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3668,7 +3669,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3682,7 +3683,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3696,7 +3697,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3710,7 +3711,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3724,7 +3725,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3738,7 +3739,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3752,7 +3753,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3766,7 +3767,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3782,7 +3783,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3796,7 +3797,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3810,7 +3811,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -3830,7 +3831,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_platform_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -3844,7 +3845,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3906,7 +3907,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3920,7 +3921,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3934,7 +3935,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -3963,7 +3964,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -3979,7 +3980,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4009,7 +4010,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4023,7 +4024,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4053,7 +4054,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << sizeof(ur_device_usm_access_capability_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4069,7 +4070,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << sizeof(ur_device_usm_access_capability_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4085,7 +4086,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << sizeof(ur_device_usm_access_capability_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4101,7 +4102,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << sizeof(ur_device_usm_access_capability_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4117,7 +4118,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << sizeof(ur_device_usm_access_capability_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4144,7 +4145,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4158,7 +4159,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4172,7 +4173,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4186,7 +4187,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4200,7 +4201,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4214,7 +4215,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4228,7 +4229,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4242,7 +4243,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4256,7 +4257,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4270,7 +4271,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4286,7 +4287,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4302,7 +4303,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4318,7 +4319,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4334,7 +4335,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -4348,7 +4349,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4362,7 +4363,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4376,7 +4377,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4390,7 +4391,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4419,7 +4420,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4433,7 +4434,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4447,7 +4448,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4461,7 +4462,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4475,7 +4476,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4489,7 +4490,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4503,7 +4504,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4517,7 +4518,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4531,7 +4532,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4545,7 +4546,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4559,7 +4560,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4573,7 +4574,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4587,7 +4588,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4601,7 +4602,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4615,7 +4616,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4629,7 +4630,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4643,7 +4644,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4657,7 +4658,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4671,7 +4672,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4685,7 +4686,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4699,7 +4700,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4713,7 +4714,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -4727,7 +4728,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -5648,7 +5649,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -5677,7 +5678,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -5691,7 +5692,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -5705,7 +5706,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -5721,7 +5722,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -5737,7 +5738,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -5753,7 +5754,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -5769,7 +5770,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -5985,7 +5986,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -5999,7 +6000,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -6203,7 +6204,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_image_format_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6217,7 +6218,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6231,7 +6232,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6245,7 +6246,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6259,7 +6260,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6273,7 +6274,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6287,7 +6288,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6594,7 +6595,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6608,7 +6609,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -6622,7 +6623,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6638,7 +6639,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6653,7 +6654,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_sampler_filter_mode_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6944,7 +6945,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_usm_type_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6952,13 +6953,13 @@ inline void serializeTagged(std::ostream &os, const void *ptr, } break; case UR_USM_ALLOC_INFO_BASE_PTR: { - const void **tptr = (const void **)ptr; + const void *const *tptr = (const void *const *)ptr; if (sizeof(void *) > size) { os << "invalid size (is: " << size << ", expected: >=" << sizeof(void *) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6972,7 +6973,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -6986,7 +6987,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -7000,7 +7001,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_usm_pool_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -7414,7 +7415,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -7428,7 +7429,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -7476,7 +7477,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -7490,7 +7491,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -7607,7 +7608,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -7869,7 +7870,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -7883,7 +7884,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -7897,7 +7898,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -7953,7 +7954,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8065,7 +8066,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_program_build_status_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8092,7 +8093,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_program_binary_type_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8242,7 +8243,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8256,7 +8257,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8270,7 +8271,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -8284,7 +8285,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_program_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -8304,7 +8305,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8382,7 +8383,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8411,7 +8412,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8425,7 +8426,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8439,7 +8440,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(size_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8494,7 +8495,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8508,7 +8509,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8522,7 +8523,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8536,7 +8537,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8608,7 +8609,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8617,7 +8618,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, case UR_KERNEL_EXEC_INFO_USM_PTRS: { - const void **tptr = (const void **)ptr; + const void *const *tptr = (const void *const *)ptr; os << "{"; size_t nelems = size / sizeof(void *); for (size_t i = 0; i < nelems; ++i) { @@ -8638,7 +8639,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_kernel_cache_config_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8799,7 +8800,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -8813,7 +8814,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_device_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -8827,7 +8828,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -8841,7 +8842,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_flags_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializeFlag(os, *tptr); @@ -8855,7 +8856,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8869,7 +8870,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -8883,7 +8884,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_bool_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9359,7 +9360,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_queue_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -9373,7 +9374,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_context_handle_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; ur_params::serializePtr(os, *tptr); @@ -9387,7 +9388,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_command_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9401,7 +9402,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(ur_event_status_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9415,7 +9416,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9474,7 +9475,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9488,7 +9489,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9502,7 +9503,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9516,7 +9517,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9530,7 +9531,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint64_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9933,7 +9934,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -9947,7 +9948,7 @@ inline void serializeTagged(std::ostream &os, const void *ptr, << ", expected: >=" << sizeof(uint32_t) << ")"; return; } - os << (void *)(tptr) << " ("; + os << (const void *)(tptr) << " ("; os << *tptr; @@ -11342,7 +11343,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pfnDeleter = "; - os << *(params->ppfnDeleter); + os << reinterpret_cast(*(params->ppfnDeleter)); os << ", "; os << ".pUserData = "; @@ -12995,7 +12996,7 @@ operator<<(std::ostream &os, os << ", "; os << ".pfnNotify = "; - os << *(params->ppfnNotify); + os << reinterpret_cast(*(params->ppfnNotify)); os << ", "; os << ".pUserData = "; @@ -15310,21 +15311,21 @@ operator<<(std::ostream &os, namespace ur_params { -template inline void serializePtr(std::ostream &os, T *ptr) { +template inline void serializePtr(std::ostream &os, const T *ptr) { if (ptr == nullptr) { os << "nullptr"; } else if constexpr (std::is_pointer_v) { - os << (void *)(ptr) << " ("; + os << (const void *)(ptr) << " ("; serializePtr(os, *ptr); os << ")"; } else if constexpr (std::is_void_v || is_handle_v) { - os << (void *)ptr; + os << (const void *)ptr; } else if constexpr (std::is_same_v, char>) { - os << (void *)(ptr) << " ("; + os << (const void *)(ptr) << " ("; os << ptr; os << ")"; } else { - os << (void *)(ptr) << " ("; + os << (const void *)(ptr) << " ("; os << *ptr; os << ")"; } diff --git a/source/loader/ur_adapter_registry.hpp b/source/loader/ur_adapter_registry.hpp index 877206c062..67ddca9890 100644 --- a/source/loader/ur_adapter_registry.hpp +++ b/source/loader/ur_adapter_registry.hpp @@ -113,10 +113,11 @@ class AdapterRegistry { // to load the adapter. std::vector> adaptersLoadPaths; - static constexpr std::array knownAdapterNames{ + static constexpr std::array knownAdapterNames{ MAKE_LIBRARY_NAME("ur_adapter_level_zero", "0"), - MAKE_LIBRARY_NAME("ur_adapter_cuda", "0"), - MAKE_LIBRARY_NAME("ur_adapter_hip", "0")}; + MAKE_LIBRARY_NAME("ur_adapter_hip", "0"), + MAKE_LIBRARY_NAME("ur_adapter_opencl", "0"), + MAKE_LIBRARY_NAME("ur_adapter_cuda", "0")}; std::optional> getEnvAdapterSearchPaths() { std::optional> pathStringsOpt; diff --git a/source/ur_api.cpp b/source/ur_api.cpp index fac4d47c2d..456c584d68 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_api.cpp - * @version v0.7-r0 + * @version v0.8-r0 * */ #include "ur_api.h" diff --git a/test/conformance/context/context_adapter_level_zero.match b/test/conformance/context/context_adapter_level_zero.match index b66630d2e7..e43bf4d5b8 100644 --- a/test/conformance/context/context_adapter_level_zero.match +++ b/test/conformance/context/context_adapter_level_zero.match @@ -1,4 +1 @@ -urContextCreateWithNativeHandleTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -{{OPT}}urContextGetInfoTestWithInfoParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_CONTEXT_INFO_USM_MEMCPY2D_SUPPORT -{{OPT}}urContextGetInfoTestWithInfoParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_CONTEXT_INFO_USM_FILL2D_SUPPORT urContextSetExtendedDeleterTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ diff --git a/test/conformance/context/urContextCreateWithNativeHandle.cpp b/test/conformance/context/urContextCreateWithNativeHandle.cpp index 04ef93c0f0..69771362b4 100644 --- a/test/conformance/context/urContextCreateWithNativeHandle.cpp +++ b/test/conformance/context/urContextCreateWithNativeHandle.cpp @@ -20,7 +20,7 @@ TEST_P(urContextCreateWithNativeHandleTest, Success) { // and perform some query on it to verify that it works. ur_context_handle_t ctx = nullptr; ur_context_native_properties_t props{}; - ASSERT_SUCCESS(urContextCreateWithNativeHandle(native_context, 0, nullptr, + ASSERT_SUCCESS(urContextCreateWithNativeHandle(native_context, 1, &device, &props, &ctx)); ASSERT_NE(ctx, nullptr); diff --git a/test/loader/loader_config/CMakeLists.txt b/test/loader/loader_config/CMakeLists.txt index b2c2ffc4ec..db07bec990 100644 --- a/test/loader/loader_config/CMakeLists.txt +++ b/test/loader/loader_config/CMakeLists.txt @@ -3,7 +3,7 @@ # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -add_executable(test-loader-config +add_ur_executable(test-loader-config urLoaderConfigCreate.cpp urLoaderConfigGetInfo.cpp urLoaderConfigEnableLayer.cpp From 3fd39f3b3c6b9e7ba298ae3bb0b945e7138c8c70 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Fri, 3 Nov 2023 13:40:17 +0100 Subject: [PATCH 077/145] [UR][CUDA] Fix compatibility with CUDA 11.x The code introduced in 74f42f8fdd3b92b355c5769bd13d4d982e839c78 uses the signature of cuGraphInstantiate from CUDA 12.x. In CUDA 11.x, this function has different parameters. --- source/adapters/cuda/command_buffer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index ad46884bf1..ff5928b10e 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -140,8 +140,13 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) { try { +#if CUDART_VERSION >= 12000 UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec, hCommandBuffer->CudaGraph, 0)); +#else + UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec, + hCommandBuffer->CudaGraph, nullptr, nullptr, 0)); +#endif } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } From 7ca370d18e857c249efa44eb8c118f82913671b1 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Fri, 3 Nov 2023 13:55:27 +0100 Subject: [PATCH 078/145] Fix formatting, use CUDA_VERSION instead of CUDART_VERSION --- source/adapters/cuda/command_buffer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index ff5928b10e..450d085053 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -140,12 +140,13 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) { try { -#if CUDART_VERSION >= 12000 +#if CUDA_VERSION >= 12000 UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec, hCommandBuffer->CudaGraph, 0)); #else UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec, - hCommandBuffer->CudaGraph, nullptr, nullptr, 0)); + hCommandBuffer->CudaGraph, nullptr, + nullptr, 0)); #endif } catch (...) { return UR_RESULT_ERROR_UNKNOWN; From 807434f3aac61d186a4774c88efbe2c9bb235a44 Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Fri, 3 Nov 2023 15:01:44 +0100 Subject: [PATCH 079/145] Add support for flags with CUDA 11.4-11.8 (untested) --- source/adapters/cuda/command_buffer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index 450d085053..f25e96a732 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -140,10 +140,15 @@ urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) { try { + const unsigned long long flags = 0; #if CUDA_VERSION >= 12000 UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec, - hCommandBuffer->CudaGraph, 0)); + hCommandBuffer->CudaGraph, flags)); +#elif CUDA_VERSION >= 11040 + UR_CHECK_ERROR(cuGraphInstantiateWithFlags( + &hCommandBuffer->CudaGraphExec, hCommandBuffer->CudaGraph, flags)); #else + // Cannot use flags UR_CHECK_ERROR(cuGraphInstantiate(&hCommandBuffer->CudaGraphExec, hCommandBuffer->CudaGraph, nullptr, nullptr, 0)); From 56f699485b1cba3ca3cddcf18c17cc1d536321db Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Fri, 3 Nov 2023 15:06:39 +0000 Subject: [PATCH 080/145] [UR][OPENCL] eliminate usage of regex in opencl --- source/adapters/opencl/common.hpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/source/adapters/opencl/common.hpp b/source/adapters/opencl/common.hpp index f78710d0df..926c9988f3 100644 --- a/source/adapters/opencl/common.hpp +++ b/source/adapters/opencl/common.hpp @@ -12,7 +12,6 @@ #include #include #include -#include #include /** @@ -72,12 +71,25 @@ class OpenCLVersion { * 'OpenCL' for devices. */ - std::regex Rx("OpenCL ([0-9]+)\\.([0-9]+)"); - std::smatch Match; + std::string_view prefix = "OpenCL "; + size_t versionBegin = Version.find_first_of(" "); + size_t versionEnd = Version.find_first_of(" ", versionBegin + 1); + size_t versionSeparator = Version.find_first_of(".", versionBegin + 1); - if (std::regex_search(Version, Match, Rx) && (Match.size() == 3)) { - OCLMajor = strtoul(Match[1].str().c_str(), nullptr, 10); - OCLMinor = strtoul(Match[2].str().c_str(), nullptr, 10); + bool haveOCLPrefix = + std::equal(prefix.begin(), prefix.end(), Version.begin()); + + if (haveOCLPrefix && versionBegin != std::string::npos && + versionEnd != std::string::npos && + versionSeparator != std::string::npos) { + + std::string versionMajor{Version.begin() + versionBegin + 1, + Version.begin() + versionSeparator}; + std::string versionMinor{Version.begin() + versionSeparator + 1, + Version.begin() + versionEnd}; + + OCLMajor = strtoul(versionMajor.c_str(), nullptr, 10); + OCLMinor = strtoul(versionMinor.c_str(), nullptr, 10); if (!isValid()) { OCLMajor = OCLMinor = 0; From 0602ce870a7d43a276ba12a850d20043e3bb0707 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 23 Oct 2023 11:10:35 +0100 Subject: [PATCH 081/145] Discourage using SYCL tc to generate kernels --- scripts/core/CUDA.rst | 8 ++++++++ scripts/core/HIP.rst | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/core/CUDA.rst b/scripts/core/CUDA.rst index 52b68c010f..9771693113 100644 --- a/scripts/core/CUDA.rst +++ b/scripts/core/CUDA.rst @@ -21,6 +21,14 @@ CUDA device images can be generated by a CUDA-capable compiler toolchain. Most CUDA compiler toolchains are capable of generating PTX, SASS and/or bundles of PTX and SASS. +When generating device code to be launched using Unified Runtime, it is +recommended to use a programming model with explicit kernel parameters, such as +OpenCL or CUDA. This is because kernels generated by a programming model with +implicit kernel parameters, such as SYCL, cannot guarantee any specific number +or ordering of kernel parameters. It has been observed that kernel signatures +for the same SYCL kernel may vary significantly when compiled for different +architectures. + PTX --- diff --git a/scripts/core/HIP.rst b/scripts/core/HIP.rst index 6e8304fe85..3ded0138ff 100644 --- a/scripts/core/HIP.rst +++ b/scripts/core/HIP.rst @@ -27,6 +27,14 @@ HIPCC can generate device code for a particular arch using the ``--genco`` flag $ hipcc --genco hello.cu --amdgpu-target=gfx906 -o hello.hsaco +When generating device code to be launched using Unified Runtime, it is +recommended to use a programming model with explicit kernel parameters, such as +OpenCL or HIP. This is because kernels generated by a programming model with +implicit kernel parameters, such as SYCL, cannot guarantee any specific number +or ordering of kernel parameters. It has been observed that kernel signatures +for the same SYCL kernel may vary significantly when compiled for different +architectures. + UR Programs =========== From 07ad4f822adee35e55ad6909a4c2dc8bba433c6b Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Wed, 8 Nov 2023 10:46:18 +0000 Subject: [PATCH 082/145] Fix some merge problems --- source/adapters/adapter.def.in | 2 ++ source/adapters/adapter.map.in | 2 ++ source/adapters/cuda/common.cpp | 2 +- source/adapters/cuda/ur_interface_loader.cpp | 20 +++++++++++++++++++ source/adapters/hip/ur_interface_loader.cpp | 20 +++++++++++++++++++ .../level_zero/ur_interface_loader.cpp | 20 +++++++++++++++++++ .../adapters/opencl/ur_interface_loader.cpp | 20 +++++++++++++++++++ .../device/device_adapter_level_zero.match | 4 ---- .../memory/memory_adapter_level_zero.match | 4 ---- .../queue/queue_adapter_level_zero.match | 2 -- 10 files changed, 85 insertions(+), 11 deletions(-) diff --git a/source/adapters/adapter.def.in b/source/adapters/adapter.def.in index de0b4fa8ee..69706127f5 100644 --- a/source/adapters/adapter.def.in +++ b/source/adapters/adapter.def.in @@ -5,8 +5,10 @@ EXPORTS urGetCommandBufferExpProcAddrTable urGetContextProcAddrTable urGetEnqueueProcAddrTable + urGetEnqueueExpProcAddrTable urGetEventProcAddrTable urGetKernelProcAddrTable + urGetKernelExpProcAddrTable urGetMemProcAddrTable urGetPhysicalMemProcAddrTable urGetPlatformProcAddrTable diff --git a/source/adapters/adapter.map.in b/source/adapters/adapter.map.in index 4379e1f7de..902c0aec69 100644 --- a/source/adapters/adapter.map.in +++ b/source/adapters/adapter.map.in @@ -5,8 +5,10 @@ urGetCommandBufferExpProcAddrTable; urGetContextProcAddrTable; urGetEnqueueProcAddrTable; + urGetEnqueueExpProcAddrTable; urGetEventProcAddrTable; urGetKernelProcAddrTable; + urGetKernelExpProcAddrTable; urGetMemProcAddrTable; urGetPhysicalMemProcAddrTable; urGetPlatformProcAddrTable; diff --git a/source/adapters/cuda/common.cpp b/source/adapters/cuda/common.cpp index 9f2a330262..492b6f7dc6 100644 --- a/source/adapters/cuda/common.cpp +++ b/source/adapters/cuda/common.cpp @@ -111,7 +111,7 @@ void detail::ur::assertion(bool Condition, const char *Message) { } void detail::ur::cuPrint(const char *Message) { - std::cerr << "ur_print: " << Message << std::endl; + std::fprintf(stderr, "ur_print: %s\n", Message); } // Global variables for ZER_EXT_RESULT_ADAPTER_SPECIFIC_ERROR diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index b87934182c..f0e8192cf3 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -390,6 +390,26 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetPhysicalMemProcAddrTable( return retVal; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ur_enqueue_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ur_kernel_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index 0e8ad3c605..f97f8f379c 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -345,6 +345,26 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetPhysicalMemProcAddrTable( return retVal; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ur_enqueue_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ur_kernel_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index 5f6da8fd86..b9b5461e75 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -430,3 +430,23 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetPhysicalMemProcAddrTable( return retVal; } + +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ur_enqueue_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ur_kernel_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index 32d26cf58c..c733dff862 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -379,6 +379,26 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetPhysicalMemProcAddrTable( return retVal; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( + ur_api_version_t version, ur_enqueue_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + +UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( + ur_api_version_t version, ur_kernel_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/test/conformance/device/device_adapter_level_zero.match b/test/conformance/device/device_adapter_level_zero.match index 3425d66967..51f9f62269 100644 --- a/test/conformance/device/device_adapter_level_zero.match +++ b/test/conformance/device/device_adapter_level_zero.match @@ -1,5 +1,3 @@ -urDeviceGetTest.InvalidValueNumEntries -{{OPT}}urDeviceGetGlobalTimestampTest.SuccessSynchronizedTime urDeviceGetInfoTest.Success/UR_DEVICE_INFO_IMAGE_SUPPORTED urDeviceGetInfoTest.Success/UR_DEVICE_INFO_GLOBAL_MEM_FREE urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT @@ -9,8 +7,6 @@ urDeviceGetInfoTest.Success/UR_DEVICE_INFO_AVAILABLE urDeviceGetInfoTest.Success/UR_DEVICE_INFO_COMPILER_AVAILABLE urDeviceGetInfoTest.Success/UR_DEVICE_INFO_LINKER_AVAILABLE urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PREFERRED_INTEROP_USER_SYNC -urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUPPORTED_PARTITIONS -urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS urDeviceGetInfoTest.Success/UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH urDeviceGetInfoTest.Success/UR_DEVICE_INFO_IMAGE_SRGB diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index 64b91fb9f3..2ee54dbabf 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -2,8 +2,4 @@ urMemBufferCreateTest.InvalidBufferSizeZero/Intel_R__oneAPI_Unified_Runtime_over urMemBufferPartitionTest.InvalidBufferSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_CONTEXT {{Segmentation fault|Aborted}} diff --git a/test/conformance/queue/queue_adapter_level_zero.match b/test/conformance/queue/queue_adapter_level_zero.match index 0013d5b397..c97aeab323 100644 --- a/test/conformance/queue/queue_adapter_level_zero.match +++ b/test/conformance/queue/queue_adapter_level_zero.match @@ -1,3 +1 @@ -urQueueCreateTest.InvalidValueProperties/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urQueueCreateTest.InvalidQueueProperties/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ {{Segmentation fault|Aborted}} From 863d2303ab7cf96c0178fd167b3990424885c434 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Fri, 10 Nov 2023 18:11:49 +0000 Subject: [PATCH 083/145] Add more merge fixes --- examples/codegen/codegen.cpp | 6 +-- source/adapters/cuda/adapter.cpp | 9 ----- source/adapters/cuda/command_buffer.cpp | 14 +++---- source/adapters/cuda/common.cpp | 2 +- source/adapters/cuda/ur_interface_loader.cpp | 24 ++++++------ source/adapters/hip/adapter.cpp | 9 ----- source/adapters/hip/command_buffer.cpp | 14 +++---- source/adapters/hip/ur_interface_loader.cpp | 25 ++++++------ source/adapters/level_zero/adapter.cpp | 18 --------- source/adapters/level_zero/command_buffer.cpp | 14 +++---- .../level_zero/ur_interface_loader.cpp | 25 ++++++------ source/adapters/null/ur_null.cpp | 38 +++++++++---------- source/adapters/opencl/adapter.cpp | 9 ----- source/adapters/opencl/command_buffer.cpp | 29 ++++++++++---- .../adapters/opencl/ur_interface_loader.cpp | 24 ++++++------ ..._cuda.match => adapter_adapter_cuda.match} | 0 ...er_hip.match => adapter_adapter_hip.match} | 0 ...match => adapter_adapter_level_zero.match} | 0 .../device/device_adapter_cuda.match | 4 -- .../event/event_adapter_cuda.match | 1 - .../conformance/event/event_adapter_hip.match | 1 - .../memory/memory_adapter_cuda.match | 4 -- .../platform/platform_adapter_hip.match | 1 - .../queue/queue_adapter_cuda.match | 1 - .../conformance/queue/queue_adapter_hip.match | 1 - test/conformance/queue/urQueueCreate.cpp | 5 +-- test/fuzz/README.md | 2 +- test/fuzz/urFuzz.cpp | 7 +++- test/loader/platforms/platforms.cpp | 2 +- tools/urinfo/urinfo.cpp | 4 +- 30 files changed, 120 insertions(+), 173 deletions(-) rename test/conformance/adapter/{runtime_adapter_cuda.match => adapter_adapter_cuda.match} (100%) rename test/conformance/adapter/{runtime_adapter_hip.match => adapter_adapter_hip.match} (100%) rename test/conformance/adapter/{runtime_adapter_level_zero.match => adapter_adapter_level_zero.match} (100%) diff --git a/examples/codegen/codegen.cpp b/examples/codegen/codegen.cpp index 203043d86d..82834688fb 100644 --- a/examples/codegen/codegen.cpp +++ b/examples/codegen/codegen.cpp @@ -24,7 +24,7 @@ constexpr unsigned PAGE_SIZE = 4096; void ur_check(const ur_result_t r) { if (r != UR_RESULT_SUCCESS) { - urTearDown(nullptr); + urLoaderTearDown(); throw std::runtime_error("Unified runtime error: " + std::to_string(r)); } } @@ -95,7 +95,7 @@ template struct alignas(PAGE_SIZE) AlignedArray { int main() { ur_loader_config_handle_t loader_config = nullptr; - ur_check(urInit(UR_DEVICE_INIT_FLAG_GPU, loader_config)); + ur_check(urLoaderInit(UR_DEVICE_INIT_FLAG_GPU, loader_config)); auto adapters = get_adapters(); auto supported_adapters = get_supported_adapters(adapters); @@ -172,5 +172,5 @@ int main() { std::cout << "Results are incorrect." << std::endl; } - return urTearDown(nullptr) == UR_RESULT_SUCCESS && expectedResult ? 0 : 1; + return urLoaderTearDown() == UR_RESULT_SUCCESS && expectedResult ? 0 : 1; } diff --git a/source/adapters/cuda/adapter.cpp b/source/adapters/cuda/adapter.cpp index ca80a99f68..5b897a8768 100644 --- a/source/adapters/cuda/adapter.cpp +++ b/source/adapters/cuda/adapter.cpp @@ -22,15 +22,6 @@ struct ur_adapter_handle_t_ { ur_adapter_handle_t_ adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t, - ur_loader_config_handle_t) { - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) { - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet(uint32_t NumEntries, ur_adapter_handle_t *phAdapters, uint32_t *pNumAdapters) { diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index ad46884bf1..317304f9c6 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -236,7 +236,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return Result; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, void *pDst, const void *pSrc, size_t size, uint32_t numSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, @@ -270,7 +270,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return Result; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, ur_mem_handle_t hDstMem, size_t srcOffset, size_t dstOffset, size_t size, uint32_t numSyncPointsInWaitList, @@ -314,7 +314,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return Result; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, ur_mem_handle_t hDstMem, ur_rect_offset_t srcOrigin, ur_rect_offset_t dstOrigin, ur_rect_region_t region, size_t srcRowPitch, @@ -356,7 +356,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, size_t offset, size_t size, const void *pSrc, uint32_t numSyncPointsInWaitList, @@ -394,7 +394,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, size_t offset, size_t size, void *pDst, uint32_t numSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, @@ -431,7 +431,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, ur_rect_offset_t bufferOffset, ur_rect_offset_t hostOffset, ur_rect_region_t region, size_t bufferRowPitch, size_t bufferSlicePitch, @@ -473,7 +473,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, ur_rect_offset_t bufferOffset, ur_rect_offset_t hostOffset, ur_rect_region_t region, size_t bufferRowPitch, size_t bufferSlicePitch, diff --git a/source/adapters/cuda/common.cpp b/source/adapters/cuda/common.cpp index 492b6f7dc6..9f2a330262 100644 --- a/source/adapters/cuda/common.cpp +++ b/source/adapters/cuda/common.cpp @@ -111,7 +111,7 @@ void detail::ur::assertion(bool Condition, const char *Message) { } void detail::ur::cuPrint(const char *Message) { - std::fprintf(stderr, "ur_print: %s\n", Message); + std::cerr << "ur_print: " << Message << std::endl; } // Global variables for ZER_EXT_RESULT_ADAPTER_SPECIFIC_ERROR diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index f0e8192cf3..67576d9552 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -202,8 +202,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != result) { return result; } - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; @@ -280,17 +278,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; diff --git a/source/adapters/hip/adapter.cpp b/source/adapters/hip/adapter.cpp index 662717f1bd..4691d78913 100644 --- a/source/adapters/hip/adapter.cpp +++ b/source/adapters/hip/adapter.cpp @@ -20,15 +20,6 @@ struct ur_adapter_handle_t_ { ur_adapter_handle_t_ adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t, - ur_loader_config_handle_t) { - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) { - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet( uint32_t, ur_adapter_handle_t *phAdapters, uint32_t *pNumAdapters) { if (phAdapters) { diff --git a/source/adapters/hip/command_buffer.cpp b/source/adapters/hip/command_buffer.cpp index 3f68b88d8d..d2cd156719 100644 --- a/source/adapters/hip/command_buffer.cpp +++ b/source/adapters/hip/command_buffer.cpp @@ -52,7 +52,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t, void *, const void *, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -61,7 +61,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, size_t, size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -70,7 +70,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, @@ -81,7 +81,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, size_t, const void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -91,7 +91,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, size_t, void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -101,7 +101,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, @@ -112,7 +112,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index f97f8f379c..af8b0f1fd1 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -202,9 +202,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != result) { return result; } - - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; @@ -278,17 +275,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; diff --git a/source/adapters/level_zero/adapter.cpp b/source/adapters/level_zero/adapter.cpp index 0a4b71a773..c511d5c8eb 100644 --- a/source/adapters/level_zero/adapter.cpp +++ b/source/adapters/level_zero/adapter.cpp @@ -13,17 +13,6 @@ ur_adapter_handle_t_ Adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL -urInit(ur_device_init_flags_t - DeviceFlags, ///< [in] device initialization flags. - ///< must be 0 (default) or a combination of - ///< ::ur_device_init_flag_t. - ur_loader_config_handle_t) { - std::ignore = DeviceFlags; - - return UR_RESULT_SUCCESS; -} - ur_result_t adapterStateTeardown() { // reclaim ur_platform_handle_t objects here since we don't have // urPlatformRelease. @@ -122,13 +111,6 @@ ur_result_t adapterStateTeardown() { return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urTearDown( - void *Params ///< [in] pointer to tear down parameters -) { - std::ignore = Params; - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet( uint32_t NumEntries, ///< [in] the number of platforms to be added to ///< phAdapters. If phAdapters is not NULL, then diff --git a/source/adapters/level_zero/command_buffer.cpp b/source/adapters/level_zero/command_buffer.cpp index 7ba3cfae4d..e8f3b061f9 100644 --- a/source/adapters/level_zero/command_buffer.cpp +++ b/source/adapters/level_zero/command_buffer.cpp @@ -545,7 +545,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t CommandBuffer, void *Dst, const void *Src, size_t Size, uint32_t NumSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *SyncPointWaitList, @@ -555,7 +555,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t SrcMem, ur_mem_handle_t DstMem, size_t SrcOffset, size_t DstOffset, size_t Size, uint32_t NumSyncPointsInWaitList, @@ -581,7 +581,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t SrcMem, ur_mem_handle_t DstMem, ur_rect_offset_t SrcOrigin, ur_rect_offset_t DstOrigin, ur_rect_region_t Region, size_t SrcRowPitch, @@ -609,7 +609,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( DstSlicePitch, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, size_t Offset, size_t Size, const void *Src, uint32_t NumSyncPointsInWaitList, @@ -628,7 +628,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( Size, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, ur_rect_offset_t BufferOffset, ur_rect_offset_t HostOffset, ur_rect_region_t Region, size_t BufferRowPitch, size_t BufferSlicePitch, @@ -648,7 +648,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( BufferSlicePitch, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, size_t Offset, size_t Size, void *Dst, uint32_t NumSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *SyncPointWaitList, @@ -663,7 +663,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( Size, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, ur_rect_offset_t BufferOffset, ur_rect_offset_t HostOffset, ur_rect_region_t Region, size_t BufferRowPitch, size_t BufferSlicePitch, diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index b9b5461e75..e2d2b0ea4b 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -32,9 +32,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != retVal) { return retVal; } - - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; @@ -321,17 +318,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; diff --git a/source/adapters/null/ur_null.cpp b/source/adapters/null/ur_null.cpp index 1a5d0aa373..d79b607ed1 100644 --- a/source/adapters/null/ur_null.cpp +++ b/source/adapters/null/ur_null.cpp @@ -164,25 +164,24 @@ context_t::context_t() { }; ////////////////////////////////////////////////////////////////////////// - urDdiTable.USM.pfnHostAlloc = - [](ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc, - ur_usm_pool_handle_t pool, size_t size, void **ppMem) { - if (size == 0) { - *ppMem = nullptr; - return UR_RESULT_ERROR_UNSUPPORTED_SIZE; - } - *ppMem = malloc(size); - if (ppMem == nullptr) { - return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return UR_RESULT_SUCCESS; - }; + urDdiTable.USM.pfnHostAlloc = [](ur_context_handle_t, const ur_usm_desc_t *, + ur_usm_pool_handle_t, size_t size, + void **ppMem) { + if (size == 0) { + *ppMem = nullptr; + return UR_RESULT_ERROR_UNSUPPORTED_SIZE; + } + *ppMem = malloc(size); + if (ppMem == nullptr) { + return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + return UR_RESULT_SUCCESS; + }; ////////////////////////////////////////////////////////////////////////// urDdiTable.USM.pfnDeviceAlloc = - [](ur_context_handle_t hContext, ur_device_handle_t hDevice, - const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t pool, - size_t size, void **ppMem) { + [](ur_context_handle_t, ur_device_handle_t, const ur_usm_desc_t *, + ur_usm_pool_handle_t, size_t size, void **ppMem) { if (size == 0) { *ppMem = nullptr; return UR_RESULT_ERROR_UNSUPPORTED_SIZE; @@ -195,16 +194,15 @@ context_t::context_t() { }; ////////////////////////////////////////////////////////////////////////// - urDdiTable.USM.pfnFree = [](ur_context_handle_t hContext, void *pMem) { + urDdiTable.USM.pfnFree = [](ur_context_handle_t, void *pMem) { free(pMem); return UR_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// urDdiTable.USM.pfnGetMemAllocInfo = - [](ur_context_handle_t hContext, const void *pMem, - ur_usm_alloc_info_t propName, size_t propSize, void *pPropValue, - size_t *pPropSizeRet) { + [](ur_context_handle_t, const void *pMem, ur_usm_alloc_info_t propName, + size_t, void *pPropValue, size_t *pPropSizeRet) { switch (propName) { case UR_USM_ALLOC_INFO_TYPE: *reinterpret_cast(pPropValue) = diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index 65c5676bf9..f1d710ebb4 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -17,15 +17,6 @@ struct ur_adapter_handle_t_ { ur_adapter_handle_t_ adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t, - ur_loader_config_handle_t) { - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) { - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet(uint32_t NumEntries, ur_adapter_handle_t *phAdapters, uint32_t *pNumAdapters) { diff --git a/source/adapters/opencl/command_buffer.cpp b/source/adapters/opencl/command_buffer.cpp index 121a991cbd..6313841121 100644 --- a/source/adapters/opencl/command_buffer.cpp +++ b/source/adapters/opencl/command_buffer.cpp @@ -65,7 +65,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] void *pDst, [[maybe_unused]] const void *pSrc, [[maybe_unused]] size_t size, @@ -79,7 +79,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hSrcMem, [[maybe_unused]] ur_mem_handle_t hDstMem, [[maybe_unused]] size_t srcOffset, @@ -94,7 +94,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hSrcMem, [[maybe_unused]] ur_mem_handle_t hDstMem, @@ -114,7 +114,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] size_t offset, [[maybe_unused]] size_t size, [[maybe_unused]] const void *pSrc, @@ -129,7 +129,22 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( + [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, + [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] size_t offset, + [[maybe_unused]] size_t size, [[maybe_unused]] const void *pSrc, + [[maybe_unused]] uint32_t numSyncPointsInWaitList, + [[maybe_unused]] const ur_exp_command_buffer_sync_point_t + *pSyncPointWaitList, + [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { + + cl_adapter::die("Experimental Command-buffer feature is not " + "implemented for OpenCL adapter."); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] size_t offset, [[maybe_unused]] size_t size, [[maybe_unused]] void *pDst, @@ -144,7 +159,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] ur_rect_offset_t bufferOffset, @@ -165,7 +180,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] ur_rect_offset_t bufferOffset, diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index dfd6ef309c..6959f57ce1 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -201,8 +201,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != Result) { return Result; } - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; @@ -287,17 +285,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; diff --git a/test/conformance/adapter/runtime_adapter_cuda.match b/test/conformance/adapter/adapter_adapter_cuda.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_cuda.match rename to test/conformance/adapter/adapter_adapter_cuda.match diff --git a/test/conformance/adapter/runtime_adapter_hip.match b/test/conformance/adapter/adapter_adapter_hip.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_hip.match rename to test/conformance/adapter/adapter_adapter_hip.match diff --git a/test/conformance/adapter/runtime_adapter_level_zero.match b/test/conformance/adapter/adapter_adapter_level_zero.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_level_zero.match rename to test/conformance/adapter/adapter_adapter_level_zero.match diff --git a/test/conformance/device/device_adapter_cuda.match b/test/conformance/device/device_adapter_cuda.match index 961e7f591d..e69de29bb2 100644 --- a/test/conformance/device/device_adapter_cuda.match +++ b/test/conformance/device/device_adapter_cuda.match @@ -1,4 +0,0 @@ -urDeviceGetTest.InvalidValueNumEntries -{{OPT}}urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUPPORTED_PARTITIONS -{{OPT}}urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE -{{OPT}}urDeviceGetInfoTest.Success/UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT diff --git a/test/conformance/event/event_adapter_cuda.match b/test/conformance/event/event_adapter_cuda.match index 19f3ddeba0..e40ea36db6 100644 --- a/test/conformance/event/event_adapter_cuda.match +++ b/test/conformance/event/event_adapter_cuda.match @@ -2,4 +2,3 @@ urEventSetCallbackTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ urEventSetCallbackTest.ValidateParameters/NVIDIA_CUDA_BACKEND___{{.*}}_ urEventSetCallbackTest.AllStates/NVIDIA_CUDA_BACKEND___{{.*}}_ urEventSetCallbackTest.EventAlreadyCompleted/NVIDIA_CUDA_BACKEND___{{.*}}_ -urEventSetCallbackNegativeTest.InvalidNullHandle/NVIDIA_CUDA_BACKEND___{{.*}}_ diff --git a/test/conformance/event/event_adapter_hip.match b/test/conformance/event/event_adapter_hip.match index 21532dac49..8682cdf4a6 100644 --- a/test/conformance/event/event_adapter_hip.match +++ b/test/conformance/event/event_adapter_hip.match @@ -2,4 +2,3 @@ urEventSetCallbackTest.Success/AMD_HIP_BACKEND___{{.*}}_ urEventSetCallbackTest.ValidateParameters/AMD_HIP_BACKEND___{{.*}}_ urEventSetCallbackTest.AllStates/AMD_HIP_BACKEND___{{.*}}_ urEventSetCallbackTest.EventAlreadyCompleted/AMD_HIP_BACKEND___{{.*}}_ -urEventSetCallbackNegativeTest.InvalidNullHandle/AMD_HIP_BACKEND___{{.*}}_ diff --git a/test/conformance/memory/memory_adapter_cuda.match b/test/conformance/memory/memory_adapter_cuda.match index 35c3504444..34989bdb3b 100644 --- a/test/conformance/memory/memory_adapter_cuda.match +++ b/test/conformance/memory/memory_adapter_cuda.match @@ -1,8 +1,4 @@ urMemBufferCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ -urMemGetInfoTest.InvalidNullPointerParamValue/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerParamValue/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidNullPointerPropSizeRet/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerPropSizeRet/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_FORMAT {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_ELEMENT_SIZE {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_ROW_PITCH diff --git a/test/conformance/platform/platform_adapter_hip.match b/test/conformance/platform/platform_adapter_hip.match index efd19f8b27..052cc6555c 100644 --- a/test/conformance/platform/platform_adapter_hip.match +++ b/test/conformance/platform/platform_adapter_hip.match @@ -1,4 +1,3 @@ -urPlatformGetTest.InvalidNumEntries urPlatformGetNativeHandleTest.Success urPlatformGetNativeHandleTest.InvalidNullHandlePlatform urPlatformGetNativeHandleTest.InvalidNullPointerNativePlatform diff --git a/test/conformance/queue/queue_adapter_cuda.match b/test/conformance/queue/queue_adapter_cuda.match index f7967fb388..a95ec21e85 100644 --- a/test/conformance/queue/queue_adapter_cuda.match +++ b/test/conformance/queue/queue_adapter_cuda.match @@ -1,4 +1,3 @@ -urQueueCreateTest.InvalidQueueProperties/NVIDIA_CUDA_BACKEND___{{.*}}_ urQueueCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_SIZE diff --git a/test/conformance/queue/queue_adapter_hip.match b/test/conformance/queue/queue_adapter_hip.match index 16166a827c..da80fb871d 100644 --- a/test/conformance/queue/queue_adapter_hip.match +++ b/test/conformance/queue/queue_adapter_hip.match @@ -1,4 +1,3 @@ -urQueueCreateTest.InvalidQueueProperties/AMD_HIP_BACKEND___{{.*}}_ urQueueCreateWithParamTest.SuccessWithProperties/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE urQueueCreateWithParamTest.SuccessWithProperties/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_FLAG_PROFILING_ENABLE urQueueGetInfoTestWithInfoParam.Success/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT diff --git a/test/conformance/queue/urQueueCreate.cpp b/test/conformance/queue/urQueueCreate.cpp index ea7026f0b5..1c5ca6e614 100644 --- a/test/conformance/queue/urQueueCreate.cpp +++ b/test/conformance/queue/urQueueCreate.cpp @@ -71,14 +71,11 @@ TEST_P(urQueueCreateTest, InvalidQueueProperties) { /*.pNext =*/nullptr, /*.flags =*/UR_QUEUE_FLAG_FORCE_UINT32, }; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, - urQueueCreate(context, device, &props, &queue)); -} // Initial value is just not a valid enum { ur_queue_handle_t queue = nullptr; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES, + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, urQueueCreate(context, device, &props, &queue)); } // It should be an error to specify both low/high priorities diff --git a/test/fuzz/README.md b/test/fuzz/README.md index 22213b4dbf..9acc3f57ac 100644 --- a/test/fuzz/README.md +++ b/test/fuzz/README.md @@ -1,6 +1,6 @@ # Corpora for fuzz tests with fixed API calls scenarios Corpora in 'corpus' directory contain UR API calls in a predefined order described below. -All such scenarios begin with single calls to urInit() and urAdapterGet(). +All such scenarios begin with single calls to urLoaderInit() and urAdapterGet(). Corpus files are binary files containing ASCII characters which are interpreted by the test backwards, meaning that bytes are read from the end of the file to the beginning of the file. diff --git a/test/fuzz/urFuzz.cpp b/test/fuzz/urFuzz.cpp index cab9a44dd2..0d24f47516 100644 --- a/test/fuzz/urFuzz.cpp +++ b/test/fuzz/urFuzz.cpp @@ -419,7 +419,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { } LoaderConfig config; - ur_result_t res = urInit(0, config.handle); + ur_result_t res = urLoaderInit(0, config.handle); if (res != UR_RESULT_SUCCESS) { return -1; } @@ -438,6 +438,11 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { } } + res = urLoaderTearDown(); + if (res != UR_RESULT_SUCCESS) { + return -1; + } + return 0; } } // namespace fuzz diff --git a/test/loader/platforms/platforms.cpp b/test/loader/platforms/platforms.cpp index 4bb487b12b..01938288a0 100644 --- a/test/loader/platforms/platforms.cpp +++ b/test/loader/platforms/platforms.cpp @@ -18,7 +18,7 @@ using namespace logger; ////////////////////////////////////////////////////////////////////////// -int main(int argc, char *argv[]) { +int main(int, char *[]) { auto out = create_logger("TEST"); ur_result_t status; diff --git a/tools/urinfo/urinfo.cpp b/tools/urinfo/urinfo.cpp index 8002cf186b..d1463ea4fa 100644 --- a/tools/urinfo/urinfo.cpp +++ b/tools/urinfo/urinfo.cpp @@ -26,7 +26,7 @@ struct app { UR_CHECK(urLoaderConfigCreate(&loaderConfig)); UR_CHECK(urLoaderConfigEnableLayer(loaderConfig, "UR_LAYER_FULL_VALIDATION")); - UR_CHECK(urInit(0, loaderConfig)); + UR_CHECK(urLoaderInit(0, loaderConfig)); enumerateDevices(); } @@ -174,7 +174,7 @@ devices which are currently visible in the local execution environment. ~app() { urLoaderConfigRelease(loaderConfig); - urTearDown(nullptr); + urLoaderTearDown(); } }; } // namespace urinfo From 07bac5387289e29f0ae6658a72323cf826fef7c7 Mon Sep 17 00:00:00 2001 From: Jaime Arteaga Date: Thu, 12 Oct 2023 13:24:56 -0700 Subject: [PATCH 084/145] [UR][L0] Correctly wait on barrier on urEnqueueEventsWaitWithBarrier When event list is null, a barrier is still needed for all previous commands if profiling is enabled, so fix it. Signed-off-by: Jaime Arteaga --- source/adapters/level_zero/event.cpp | 7 ++++--- source/adapters/level_zero/queue.hpp | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index b979c8ab15..ba6ec7dfe6 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -168,7 +168,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( // TODO: this and other special handling of in-order queues to be // updated when/if Level Zero adds native support for in-order queues. // - if (Queue->isInOrderQueue() && InOrderBarrierBySignal) { + if (Queue->isInOrderQueue() && InOrderBarrierBySignal && + !Queue->isProfilingEnabled()) { if (EventWaitList.Length) { ZE2UR_CALL(zeCommandListAppendWaitOnEvents, (CmdList->first, EventWaitList.Length, @@ -181,6 +182,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( (CmdList->first, Event->ZeEvent, EventWaitList.Length, EventWaitList.ZeEventList)); } + return UR_RESULT_SUCCESS; }; @@ -964,8 +966,7 @@ ur_result_t CleanupCompletedEvent(ur_event_handle_t Event, bool QueueLocked, ur_result_t EventCreate(ur_context_handle_t Context, ur_queue_handle_t Queue, bool HostVisible, ur_event_handle_t *RetEvent) { - bool ProfilingEnabled = - !Queue || (Queue->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE) != 0; + bool ProfilingEnabled = !Queue || Queue->isProfilingEnabled(); if (auto CachedEvent = Context->getEventFromContextCache(HostVisible, ProfilingEnabled)) { diff --git a/source/adapters/level_zero/queue.hpp b/source/adapters/level_zero/queue.hpp index 9c90a999b3..306cec5416 100644 --- a/source/adapters/level_zero/queue.hpp +++ b/source/adapters/level_zero/queue.hpp @@ -515,6 +515,11 @@ struct ur_queue_handle_t_ : _ur_object { // lists in the queue. ur_result_t insertStartBarrierIfDiscardEventsMode(ur_command_list_ptr_t &CmdList); + + // returns true if queue has profiling enabled + bool isProfilingEnabled() { + return ((this->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE) != 0); + } }; // This helper function creates a ur_event_handle_t and associate a From 7fd9dafd0fb921a3e3a1a497a8458fcae414d384 Mon Sep 17 00:00:00 2001 From: Jaime Arteaga Date: Wed, 8 Nov 2023 12:52:43 -0800 Subject: [PATCH 085/145] Address comments Signed-off-by: Jaime Arteaga --- source/adapters/level_zero/event.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index ba6ec7dfe6..d8af1e674d 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -165,6 +165,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( // event signal because it is already guaranteed that previous commands // in this queue are completed when the signal is started. // + // Only consideration here is that when profiling is used, signalEvent + // cannot be used if EventWaitList.Lenght == 0. In those cases, we need + // to fallback directly to barrier to have correct timestamps. See here: + // https://spec.oneapi.io/level-zero/latest/core/api.html?highlight=appendsignalevent#_CPPv430zeCommandListAppendSignalEvent24ze_command_list_handle_t17ze_event_handle_t + // // TODO: this and other special handling of in-order queues to be // updated when/if Level Zero adds native support for in-order queues. // From 19bcf6c27be50ddbc64733a4d207d7b0d892ebbc Mon Sep 17 00:00:00 2001 From: pbalcer Date: Tue, 14 Nov 2023 14:05:40 +0100 Subject: [PATCH 086/145] [common] add codecov --- .github/workflows/coverage.yml | 78 ++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000000..ad1ac23e7a --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,78 @@ +name: Coverage + +on: [push, pull_request] + +jobs: + ubuntu-build: + name: Build - Ubuntu + strategy: + matrix: + os: ['ubuntu-22.04'] + build_type: [Debug] + compiler: [{c: gcc, cxx: g++}] + libbacktrace: ['-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON'] + pool_tracking: ['-DUMF_ENABLE_POOL_TRACKING=ON'] + + runs-on: ${{matrix.os}} + + steps: + - uses: actions/checkout@v3 + + - name: Install apt packages + run: | + sudo apt-get update + sudo apt-get install -y doxygen ${{matrix.compiler.c}} + + - name: Install pip packages + run: pip install -r third_party/requirements.txt + + - name: Install libbacktrace + if: matrix.libbacktrace == '-DVAL_USE_LIBBACKTRACE_BACKTRACE=ON' + run: | + git clone https://github.com/ianlancetaylor/libbacktrace.git + cd libbacktrace + ./configure + make + sudo make install + cd .. + + - name: Download DPC++ + run: | + sudo apt install libncurses5 + wget -O ${{github.workspace}}/dpcpp_compiler.tar.gz https://github.com/intel/llvm/releases/download/sycl-nightly%2F20230626/dpcpp-compiler.tar.gz + tar -xvf ${{github.workspace}}/dpcpp_compiler.tar.gz + + - name: Configure CMake + run: > + cmake + -B${{github.workspace}}/build + -DCMAKE_C_COMPILER=${{matrix.compiler.c}} + -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} + -DUR_ENABLE_TRACING=ON + -DUR_DEVELOPER_MODE=ON + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} + -DUR_BUILD_TESTS=ON + -DUR_FORMAT_CPP_STYLE=ON + -DUR_DPCXX=${{github.workspace}}/dpcpp_compiler/bin/clang++ + -DCMAKE_CXX_FLAGS="--coverage -fkeep-inline-functions -fkeep-static-functions" + -DCMAKE_EXE_LINKER_FLAGS="--coverage" + -DCMAKE_SHARED_LINKER_FLAGS="--coverage" + ${{matrix.libbacktrace}} + ${{matrix.pool_tracking}} + + - name: Build + run: cmake --build ${{github.workspace}}/build -j $(nproc) + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -C ${{matrix.build_type}} --output-on-failure -L "python|umf|loader|validation|tracing|unit|urtrace" + + - name: Quick Coverage Info + working-directory: ${{github.workspace}}/build + run: ctest -T Coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + gcov: true + gcov_include: source From a42adf27c0947abc2ef97a11bc34750728bb03b5 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Tue, 17 Oct 2023 12:39:39 +0100 Subject: [PATCH 087/145] [OpenCL] Add Command Buffer extension to OpenCL adapter. --- source/adapters/opencl/command_buffer.cpp | 283 +++++++++++++++------- source/adapters/opencl/command_buffer.hpp | 13 +- source/adapters/opencl/common.cpp | 4 + source/adapters/opencl/common.hpp | 71 ++++++ source/adapters/opencl/device.cpp | 17 +- 5 files changed, 304 insertions(+), 84 deletions(-) diff --git a/source/adapters/opencl/command_buffer.cpp b/source/adapters/opencl/command_buffer.cpp index 121a991cbd..a3c4ef29b1 100644 --- a/source/adapters/opencl/command_buffer.cpp +++ b/source/adapters/opencl/command_buffer.cpp @@ -11,58 +11,118 @@ #include "command_buffer.hpp" #include "common.hpp" -/// Stub implementations of UR experimental feature command-buffers - UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferCreateExp( - [[maybe_unused]] ur_context_handle_t hContext, - [[maybe_unused]] ur_device_handle_t hDevice, + ur_context_handle_t hContext, ur_device_handle_t hDevice, [[maybe_unused]] const ur_exp_command_buffer_desc_t *pCommandBufferDesc, - [[maybe_unused]] ur_exp_command_buffer_handle_t *phCommandBuffer) { + ur_exp_command_buffer_handle_t *phCommandBuffer) { - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + ur_queue_handle_t Queue = nullptr; + UR_RETURN_ON_FAILURE(urQueueCreate(hContext, hDevice, nullptr, &Queue)); + + cl_context CLContext = cl_adapter::cast(hContext); + cl_ext::clCreateCommandBufferKHR_fn clCreateCommandBufferKHR = nullptr; + cl_int Res = + cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clCreateCommandBufferKHRCache, + cl_ext::CreateCommandBufferName, &clCreateCommandBufferKHR); + + if (!clCreateCommandBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + auto CLCommandBuffer = clCreateCommandBufferKHR( + 1, cl_adapter::cast(&Queue), nullptr, &Res); + CL_RETURN_ON_FAILURE_AND_SET_NULL(Res, phCommandBuffer); + + try { + auto URCommandBuffer = std::make_unique( + Queue, hContext, CLCommandBuffer); + *phCommandBuffer = URCommandBuffer.release(); + } catch (...) { + return UR_RESULT_ERROR_OUT_OF_RESOURCES; + } + + CL_RETURN_ON_FAILURE(Res); + return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferRetainExp( - [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer) { +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferRetainExp(ur_exp_command_buffer_handle_t hCommandBuffer) { + UR_RETURN_ON_FAILURE(urQueueRetain(hCommandBuffer->hInternalQueue)); - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clRetainCommandBufferKHR_fn clRetainCommandBuffer = nullptr; + cl_int Res = cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clRetainCommandBufferKHRCache, + cl_ext::RetainCommandBufferName, &clRetainCommandBuffer); + + if (!clRetainCommandBuffer || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE(clRetainCommandBuffer(hCommandBuffer->CLCommandBuffer)); + return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferReleaseExp( - [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer) { +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferReleaseExp(ur_exp_command_buffer_handle_t hCommandBuffer) { + UR_RETURN_ON_FAILURE(urQueueRelease(hCommandBuffer->hInternalQueue)); - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clReleaseCommandBufferKHR_fn clReleaseCommandBufferKHR = nullptr; + cl_int Res = + cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clReleaseCommandBufferKHRCache, + cl_ext::ReleaseCommandBufferName, &clReleaseCommandBufferKHR); + + if (!clReleaseCommandBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE( + clReleaseCommandBufferKHR(hCommandBuffer->CLCommandBuffer)); + return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferFinalizeExp( - [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer) { +UR_APIEXPORT ur_result_t UR_APICALL +urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t hCommandBuffer) { + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clFinalizeCommandBufferKHR_fn clFinalizeCommandBufferKHR = nullptr; + cl_int Res = + cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clFinalizeCommandBufferKHRCache, + cl_ext::FinalizeCommandBufferName, &clFinalizeCommandBufferKHR); - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + if (!clFinalizeCommandBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE( + clFinalizeCommandBufferKHR(hCommandBuffer->CLCommandBuffer)); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( - [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, - [[maybe_unused]] ur_kernel_handle_t hKernel, - [[maybe_unused]] uint32_t workDim, - [[maybe_unused]] const size_t *pGlobalWorkOffset, - [[maybe_unused]] const size_t *pGlobalWorkSize, - [[maybe_unused]] const size_t *pLocalWorkSize, - [[maybe_unused]] uint32_t numSyncPointsInWaitList, - [[maybe_unused]] const ur_exp_command_buffer_sync_point_t - *pSyncPointWaitList, - [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { + ur_exp_command_buffer_handle_t hCommandBuffer, ur_kernel_handle_t hKernel, + uint32_t workDim, const size_t *pGlobalWorkOffset, + const size_t *pGlobalWorkSize, const size_t *pLocalWorkSize, + uint32_t numSyncPointsInWaitList, + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + ur_exp_command_buffer_sync_point_t *pSyncPoint) { - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clCommandNDRangeKernelKHR_fn clCommandNDRangeKernelKHR = nullptr; + cl_int Res = + cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clCommandNDRangeKernelKHRCache, + cl_ext::CommandNRRangeKernelName, &clCommandNDRangeKernelKHR); + + if (!clCommandNDRangeKernelKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE(clCommandNDRangeKernelKHR( + hCommandBuffer->CLCommandBuffer, nullptr, nullptr, + cl_adapter::cast(hKernel), workDim, pGlobalWorkOffset, + pGlobalWorkSize, pLocalWorkSize, numSyncPointsInWaitList, + pSyncPointWaitList, pSyncPoint, nullptr)); + + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( @@ -73,44 +133,78 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( [[maybe_unused]] const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { - - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, - [[maybe_unused]] ur_mem_handle_t hSrcMem, - [[maybe_unused]] ur_mem_handle_t hDstMem, [[maybe_unused]] size_t srcOffset, - [[maybe_unused]] size_t dstOffset, [[maybe_unused]] size_t size, + [[maybe_unused]] void *pMemory, [[maybe_unused]] const void *pPattern, + [[maybe_unused]] size_t patternSize, [[maybe_unused]] size_t size, [[maybe_unused]] uint32_t numSyncPointsInWaitList, [[maybe_unused]] const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { - - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, + ur_mem_handle_t hDstMem, size_t srcOffset, size_t dstOffset, size_t size, + uint32_t numSyncPointsInWaitList, + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + ur_exp_command_buffer_sync_point_t *pSyncPoint) { + + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clCommandCopyBufferKHR_fn clCommandCopyBufferKHR = nullptr; + cl_int Res = cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clCommandCopyBufferKHRCache, + cl_ext::CommandCopyBufferName, &clCommandCopyBufferKHR); + + if (!clCommandCopyBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE(clCommandCopyBufferKHR( + hCommandBuffer->CLCommandBuffer, + nullptr, + cl_adapter::cast(hSrcMem), cl_adapter::cast(hDstMem), + srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, + pSyncPoint, nullptr)); + + return UR_RESULT_SUCCESS; +} + UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( - [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, - [[maybe_unused]] ur_mem_handle_t hSrcMem, - [[maybe_unused]] ur_mem_handle_t hDstMem, - [[maybe_unused]] ur_rect_offset_t srcOrigin, - [[maybe_unused]] ur_rect_offset_t dstOrigin, - [[maybe_unused]] ur_rect_region_t region, - [[maybe_unused]] size_t srcRowPitch, [[maybe_unused]] size_t srcSlicePitch, - [[maybe_unused]] size_t dstRowPitch, [[maybe_unused]] size_t dstSlicePitch, - [[maybe_unused]] uint32_t numSyncPointsInWaitList, - [[maybe_unused]] const ur_exp_command_buffer_sync_point_t - *pSyncPointWaitList, - [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { + ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, + ur_mem_handle_t hDstMem, ur_rect_offset_t srcOrigin, + ur_rect_offset_t dstOrigin, ur_rect_region_t region, size_t srcRowPitch, + size_t srcSlicePitch, size_t dstRowPitch, size_t dstSlicePitch, + uint32_t numSyncPointsInWaitList, + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + ur_exp_command_buffer_sync_point_t *pSyncPoint) { - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + size_t OpenCLOriginRect[3]{srcOrigin.x, srcOrigin.y, srcOrigin.z}; + size_t OpenCLDstRect[3]{dstOrigin.x, dstOrigin.y, dstOrigin.z}; + size_t OpenCLRegion[3]{region.width, region.height, region.depth}; + + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clCommandCopyBufferRectKHR_fn clCommandCopyBufferRectKHR = nullptr; + cl_int Res = + cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clCommandCopyBufferRectKHRCache, + cl_ext::CommandCopyBufferRectName, &clCommandCopyBufferRectKHR); + + if (!clCommandCopyBufferRectKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE(clCommandCopyBufferRectKHR( + hCommandBuffer->CLCommandBuffer, + nullptr, + cl_adapter::cast(hSrcMem), cl_adapter::cast(hDstMem), + OpenCLOriginRect, OpenCLDstRect, OpenCLRegion, srcRowPitch, srcSlicePitch, + dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, + pSyncPoint, nullptr)); + + return UR_RESULT_SUCCESS; } UR_APIEXPORT @@ -122,9 +216,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( [[maybe_unused]] const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { - - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -137,9 +228,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( [[maybe_unused]] const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { - - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -158,9 +246,6 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( [[maybe_unused]] const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { - - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } @@ -179,20 +264,56 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( [[maybe_unused]] const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { - - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferFillExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, + const void *pPattern, size_t patternSize, size_t offset, size_t size, + uint32_t numSyncPointsInWaitList, + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + ur_exp_command_buffer_sync_point_t *pSyncPoint) { + + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clCommandFillBufferKHR_fn clCommandFillBufferKHR = nullptr; + cl_int Res = cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clCommandFillBufferKHRCache, + cl_ext::CommandFillBufferName, &clCommandFillBufferKHR); + + if (!clCommandFillBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE(clCommandFillBufferKHR( + hCommandBuffer->CLCommandBuffer, + nullptr, + cl_adapter::cast(hBuffer), pPattern, patternSize, offset, size, + numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint, nullptr)); + + return UR_RESULT_SUCCESS; +} + UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( - [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, - [[maybe_unused]] ur_queue_handle_t hQueue, - [[maybe_unused]] uint32_t numEventsInWaitList, - [[maybe_unused]] const ur_event_handle_t *phEventWaitList, - [[maybe_unused]] ur_event_handle_t *phEvent) { + ur_exp_command_buffer_handle_t hCommandBuffer, ur_queue_handle_t hQueue, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { - cl_adapter::die("Experimental Command-buffer feature is not " - "implemented for OpenCL adapter."); - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clEnqueueCommandBufferKHR_fn clEnqueueCommandBufferKHR = nullptr; + cl_int Res = + cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clEnqueueCommandBufferKHRCache, + cl_ext::EnqueueCommandBufferName, &clEnqueueCommandBufferKHR); + + if (!clEnqueueCommandBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + const uint32_t NumberOfQueues = 1; + + CL_RETURN_ON_FAILURE(clEnqueueCommandBufferKHR( + NumberOfQueues, cl_adapter::cast(&hQueue), + hCommandBuffer->CLCommandBuffer, numEventsInWaitList, + cl_adapter::cast(phEventWaitList), + cl_adapter::cast(phEvent))); + + return UR_RESULT_SUCCESS; } diff --git a/source/adapters/opencl/command_buffer.hpp b/source/adapters/opencl/command_buffer.hpp index 7ab145c53d..d80f29594b 100644 --- a/source/adapters/opencl/command_buffer.hpp +++ b/source/adapters/opencl/command_buffer.hpp @@ -8,8 +8,17 @@ // //===----------------------------------------------------------------------===// +#include #include -/// Stub implementation of command-buffers for OpenCL +struct ur_exp_command_buffer_handle_t_ { + ur_queue_handle_t hInternalQueue; + ur_context_handle_t hContext; + cl_command_buffer_khr CLCommandBuffer; -struct ur_exp_command_buffer_handle_t_ {}; + ur_exp_command_buffer_handle_t_(ur_queue_handle_t hQueue, + ur_context_handle_t hContext, + cl_command_buffer_khr CLCommandBuffer) + : hInternalQueue(hQueue), hContext(hContext), + CLCommandBuffer(CLCommandBuffer) {} +}; diff --git a/source/adapters/opencl/common.cpp b/source/adapters/opencl/common.cpp index 77a51694dd..4fe8bed408 100644 --- a/source/adapters/opencl/common.cpp +++ b/source/adapters/opencl/common.cpp @@ -77,6 +77,10 @@ ur_result_t mapCLErrorToUR(cl_int Result) { return UR_RESULT_ERROR_PROGRAM_LINK_FAILURE; case CL_INVALID_ARG_INDEX: return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX; + case CL_INVALID_COMMAND_BUFFER_KHR: + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_EXP; + case CL_INVALID_SYNC_POINT_WAIT_LIST_KHR: + return UR_RESULT_ERROR_INVALID_COMMAND_BUFFER_SYNC_POINT_WAIT_LIST_EXP; default: return UR_RESULT_ERROR_UNKNOWN; } diff --git a/source/adapters/opencl/common.hpp b/source/adapters/opencl/common.hpp index 95105b552d..767dc02fda 100644 --- a/source/adapters/opencl/common.hpp +++ b/source/adapters/opencl/common.hpp @@ -192,6 +192,16 @@ CONSTFIX char EnqueueReadGlobalVariableName[] = // Names of host pipe functions queried from OpenCL CONSTFIX char EnqueueReadHostPipeName[] = "clEnqueueReadHostPipeINTEL"; CONSTFIX char EnqueueWriteHostPipeName[] = "clEnqueueWriteHostPipeINTEL"; +// Names of command buffer functions queried from OpenCL +CONSTFIX char CreateCommandBufferName[] = "clCreateCommandBufferKHR"; +CONSTFIX char RetainCommandBufferName[] = "clRetainCommandBufferKHR"; +CONSTFIX char ReleaseCommandBufferName[] = "clReleaseCommandBufferKHR"; +CONSTFIX char FinalizeCommandBufferName[] = "clFinalizeCommandBufferKHR"; +CONSTFIX char CommandNRRangeKernelName[] = "clCommandNDRangeKernelKHR"; +CONSTFIX char CommandCopyBufferName[] = "clCommandCopyBufferKHR"; +CONSTFIX char CommandCopyBufferRectName[] = "clCommandCopyBufferRectKHR"; +CONSTFIX char CommandFillBufferName[] = "clCommandFillBufferKHR"; +CONSTFIX char EnqueueCommandBufferName[] = "clEnqueueCommandBufferKHR"; #undef CONSTFIX @@ -226,6 +236,58 @@ cl_int(CL_API_CALL *)(cl_command_queue queue, cl_program program, cl_uint num_events_in_waitlist, const cl_event *events_waitlist, cl_event *event); +using clCreateCommandBufferKHR_fn = CL_API_ENTRY cl_command_buffer_khr( + CL_API_CALL *)(cl_uint num_queues, const cl_command_queue *queues, + const cl_command_buffer_properties_khr *properties, + cl_int *errcode_ret); + +using clRetainCommandBufferKHR_fn = CL_API_ENTRY +cl_int(CL_API_CALL *)(cl_command_buffer_khr command_buffer); + +using clReleaseCommandBufferKHR_fn = CL_API_ENTRY +cl_int(CL_API_CALL *)(cl_command_buffer_khr command_buffer); + +using clFinalizeCommandBufferKHR_fn = CL_API_ENTRY +cl_int(CL_API_CALL *)(cl_command_buffer_khr command_buffer); + +using clCommandNDRangeKernelKHR_fn = CL_API_ENTRY cl_int(CL_API_CALL *)( + cl_command_buffer_khr command_buffer, cl_command_queue command_queue, + const cl_ndrange_kernel_command_properties_khr *properties, + cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, + const size_t *global_work_size, const size_t *local_work_size, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr *sync_point_wait_list, + cl_sync_point_khr *sync_point, cl_mutable_command_khr *mutable_handle); + +using clCommandCopyBufferKHR_fn = CL_API_ENTRY cl_int(CL_API_CALL *)( + cl_command_buffer_khr command_buffer, cl_command_queue command_queue, + cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, + size_t size, cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr *sync_point_wait_list, + cl_sync_point_khr *sync_point, cl_mutable_command_khr *mutable_handle); + +using clCommandCopyBufferRectKHR_fn = CL_API_ENTRY cl_int(CL_API_CALL *)( + cl_command_buffer_khr command_buffer, cl_command_queue command_queue, + cl_mem src_buffer, cl_mem dst_buffer, const size_t *src_origin, + const size_t *dst_origin, const size_t *region, size_t src_row_pitch, + size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, + cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr *sync_point_wait_list, + cl_sync_point_khr *sync_point, cl_mutable_command_khr *mutable_handle); + +using clCommandFillBufferKHR_fn = CL_API_ENTRY cl_int(CL_API_CALL *)( + cl_command_buffer_khr command_buffer, cl_command_queue command_queue, + cl_mem buffer, const void *pattern, size_t pattern_size, size_t offset, + size_t size, cl_uint num_sync_points_in_wait_list, + const cl_sync_point_khr *sync_point_wait_list, + cl_sync_point_khr *sync_point, cl_mutable_command_khr *mutable_handle); + +using clEnqueueCommandBufferKHR_fn = CL_API_ENTRY +cl_int(CL_API_CALL *)(cl_uint num_queues, cl_command_queue *queues, + cl_command_buffer_khr command_buffer, + cl_uint num_events_in_wait_list, + const cl_event *event_wait_list, cl_event *event); + template struct FuncPtrCache { std::map Map; std::mutex Mutex; @@ -255,6 +317,15 @@ struct ExtFuncPtrCacheT { FuncPtrCache clEnqueueWriteHostPipeINTELCache; FuncPtrCache clSetProgramSpecializationConstantCache; + FuncPtrCache clCreateCommandBufferKHRCache; + FuncPtrCache clRetainCommandBufferKHRCache; + FuncPtrCache clReleaseCommandBufferKHRCache; + FuncPtrCache clFinalizeCommandBufferKHRCache; + FuncPtrCache clCommandNDRangeKernelKHRCache; + FuncPtrCache clCommandCopyBufferKHRCache; + FuncPtrCache clCommandCopyBufferRectKHRCache; + FuncPtrCache clCommandFillBufferKHRCache; + FuncPtrCache clEnqueueCommandBufferKHRCache; }; // A raw pointer is used here since the lifetime of this map has to be tied to // piTeardown to avoid issues with static destruction order (a user application diff --git a/source/adapters/opencl/device.cpp b/source/adapters/opencl/device.cpp index 710ebcfb88..27577eab39 100644 --- a/source/adapters/opencl/device.cpp +++ b/source/adapters/opencl/device.cpp @@ -886,7 +886,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, case UR_DEVICE_INFO_PROFILE: case UR_DEVICE_INFO_VERSION: case UR_EXT_DEVICE_INFO_OPENCL_C_VERSION: - case UR_DEVICE_INFO_EXTENSIONS: case UR_DEVICE_INFO_BUILT_IN_KERNELS: case UR_DEVICE_INFO_MAX_WORK_ITEM_SIZES: case UR_DEVICE_INFO_SUB_GROUP_SIZES_INTEL: @@ -908,6 +907,22 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, return UR_RESULT_SUCCESS; } + case UR_DEVICE_INFO_EXTENSIONS: { + cl_device_id Dev = cl_adapter::cast(hDevice); + size_t ExtSize = 0; + CL_RETURN_ON_FAILURE( + clGetDeviceInfo(Dev, CL_DEVICE_EXTENSIONS, 0, nullptr, &ExtSize)); + + std::string ExtStr(ExtSize, '\0'); + CL_RETURN_ON_FAILURE(clGetDeviceInfo(Dev, CL_DEVICE_EXTENSIONS, ExtSize, + ExtStr.data(), nullptr)); + + std::string SupportedExtensions(ExtStr.c_str()); + if (ExtStr.find("cl_khr_command_buffer") != std::string::npos) { + SupportedExtensions += " ur_exp_command_buffer"; + } + return ReturnValue(SupportedExtensions.c_str()); + } /* TODO: Check regularly to see if support is enabled in OpenCL. Intel GPU * EU device-specific information extensions. Some of the queries are * enabled by cl_intel_device_attribute_query extension, but it's not yet in From d86aada2048e544548883ab0bdbf8b6195afdd05 Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Fri, 10 Nov 2023 18:11:49 +0000 Subject: [PATCH 088/145] Add more merge fixes --- examples/codegen/codegen.cpp | 6 +-- source/adapters/cuda/adapter.cpp | 9 ----- source/adapters/cuda/command_buffer.cpp | 14 +++---- source/adapters/cuda/common.cpp | 2 +- source/adapters/cuda/ur_interface_loader.cpp | 28 ++++++------- source/adapters/hip/adapter.cpp | 9 ----- source/adapters/hip/command_buffer.cpp | 14 +++---- source/adapters/hip/ur_interface_loader.cpp | 29 +++++++------- source/adapters/level_zero/adapter.cpp | 18 --------- source/adapters/level_zero/command_buffer.cpp | 14 +++---- .../level_zero/ur_interface_loader.cpp | 39 ++++++++++++------- source/adapters/null/ur_null.cpp | 38 +++++++++--------- source/adapters/opencl/adapter.cpp | 9 ----- source/adapters/opencl/command_buffer.cpp | 29 ++++++++++---- .../adapters/opencl/ur_interface_loader.cpp | 28 ++++++------- ..._cuda.match => adapter_adapter_cuda.match} | 0 ...er_hip.match => adapter_adapter_hip.match} | 0 ...match => adapter_adapter_level_zero.match} | 0 .../device/device_adapter_cuda.match | 4 -- .../event/event_adapter_cuda.match | 1 - .../conformance/event/event_adapter_hip.match | 1 - .../memory/memory_adapter_cuda.match | 4 -- .../platform/platform_adapter_hip.match | 1 - .../queue/queue_adapter_cuda.match | 1 - .../conformance/queue/queue_adapter_hip.match | 1 - test/conformance/queue/urQueueCreate.cpp | 5 +-- test/fuzz/README.md | 2 +- test/fuzz/urFuzz.cpp | 7 +++- test/loader/platforms/platforms.cpp | 2 +- tools/urinfo/urinfo.cpp | 4 +- 30 files changed, 146 insertions(+), 173 deletions(-) rename test/conformance/adapter/{runtime_adapter_cuda.match => adapter_adapter_cuda.match} (100%) rename test/conformance/adapter/{runtime_adapter_hip.match => adapter_adapter_hip.match} (100%) rename test/conformance/adapter/{runtime_adapter_level_zero.match => adapter_adapter_level_zero.match} (100%) diff --git a/examples/codegen/codegen.cpp b/examples/codegen/codegen.cpp index 203043d86d..82834688fb 100644 --- a/examples/codegen/codegen.cpp +++ b/examples/codegen/codegen.cpp @@ -24,7 +24,7 @@ constexpr unsigned PAGE_SIZE = 4096; void ur_check(const ur_result_t r) { if (r != UR_RESULT_SUCCESS) { - urTearDown(nullptr); + urLoaderTearDown(); throw std::runtime_error("Unified runtime error: " + std::to_string(r)); } } @@ -95,7 +95,7 @@ template struct alignas(PAGE_SIZE) AlignedArray { int main() { ur_loader_config_handle_t loader_config = nullptr; - ur_check(urInit(UR_DEVICE_INIT_FLAG_GPU, loader_config)); + ur_check(urLoaderInit(UR_DEVICE_INIT_FLAG_GPU, loader_config)); auto adapters = get_adapters(); auto supported_adapters = get_supported_adapters(adapters); @@ -172,5 +172,5 @@ int main() { std::cout << "Results are incorrect." << std::endl; } - return urTearDown(nullptr) == UR_RESULT_SUCCESS && expectedResult ? 0 : 1; + return urLoaderTearDown() == UR_RESULT_SUCCESS && expectedResult ? 0 : 1; } diff --git a/source/adapters/cuda/adapter.cpp b/source/adapters/cuda/adapter.cpp index ca80a99f68..5b897a8768 100644 --- a/source/adapters/cuda/adapter.cpp +++ b/source/adapters/cuda/adapter.cpp @@ -22,15 +22,6 @@ struct ur_adapter_handle_t_ { ur_adapter_handle_t_ adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t, - ur_loader_config_handle_t) { - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) { - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet(uint32_t NumEntries, ur_adapter_handle_t *phAdapters, uint32_t *pNumAdapters) { diff --git a/source/adapters/cuda/command_buffer.cpp b/source/adapters/cuda/command_buffer.cpp index ad46884bf1..317304f9c6 100644 --- a/source/adapters/cuda/command_buffer.cpp +++ b/source/adapters/cuda/command_buffer.cpp @@ -236,7 +236,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return Result; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t hCommandBuffer, void *pDst, const void *pSrc, size_t size, uint32_t numSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, @@ -270,7 +270,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return Result; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, ur_mem_handle_t hDstMem, size_t srcOffset, size_t dstOffset, size_t size, uint32_t numSyncPointsInWaitList, @@ -314,7 +314,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return Result; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, ur_mem_handle_t hDstMem, ur_rect_offset_t srcOrigin, ur_rect_offset_t dstOrigin, ur_rect_region_t region, size_t srcRowPitch, @@ -356,7 +356,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, size_t offset, size_t size, const void *pSrc, uint32_t numSyncPointsInWaitList, @@ -394,7 +394,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, size_t offset, size_t size, void *pDst, uint32_t numSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, @@ -431,7 +431,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, ur_rect_offset_t bufferOffset, ur_rect_offset_t hostOffset, ur_rect_region_t region, size_t bufferRowPitch, size_t bufferSlicePitch, @@ -473,7 +473,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hBuffer, ur_rect_offset_t bufferOffset, ur_rect_offset_t hostOffset, ur_rect_region_t region, size_t bufferRowPitch, size_t bufferSlicePitch, diff --git a/source/adapters/cuda/common.cpp b/source/adapters/cuda/common.cpp index 492b6f7dc6..9f2a330262 100644 --- a/source/adapters/cuda/common.cpp +++ b/source/adapters/cuda/common.cpp @@ -111,7 +111,7 @@ void detail::ur::assertion(bool Condition, const char *Message) { } void detail::ur::cuPrint(const char *Message) { - std::fprintf(stderr, "ur_print: %s\n", Message); + std::cerr << "ur_print: " << Message << std::endl; } // Global variables for ZER_EXT_RESULT_ADAPTER_SPECIFIC_ERROR diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index f0e8192cf3..0a5dd5a04f 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -202,8 +202,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != result) { return result; } - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; @@ -280,17 +278,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; @@ -397,6 +395,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( return result; } + pDdiTable->pfnCooperativeKernelLaunchExp = nullptr; + return UR_RESULT_SUCCESS; } @@ -407,6 +407,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return result; } + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = nullptr; + return UR_RESULT_SUCCESS; } diff --git a/source/adapters/hip/adapter.cpp b/source/adapters/hip/adapter.cpp index 662717f1bd..4691d78913 100644 --- a/source/adapters/hip/adapter.cpp +++ b/source/adapters/hip/adapter.cpp @@ -20,15 +20,6 @@ struct ur_adapter_handle_t_ { ur_adapter_handle_t_ adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t, - ur_loader_config_handle_t) { - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) { - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet( uint32_t, ur_adapter_handle_t *phAdapters, uint32_t *pNumAdapters) { if (phAdapters) { diff --git a/source/adapters/hip/command_buffer.cpp b/source/adapters/hip/command_buffer.cpp index 3f68b88d8d..d2cd156719 100644 --- a/source/adapters/hip/command_buffer.cpp +++ b/source/adapters/hip/command_buffer.cpp @@ -52,7 +52,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t, void *, const void *, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -61,7 +61,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, size_t, size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -70,7 +70,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, uint32_t, const ur_exp_command_buffer_sync_point_t *, @@ -81,7 +81,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, size_t, const void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -91,7 +91,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, size_t, size_t, void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, ur_exp_command_buffer_sync_point_t *) { @@ -101,7 +101,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, @@ -112,7 +112,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t, ur_mem_handle_t, ur_rect_offset_t, ur_rect_offset_t, ur_rect_region_t, size_t, size_t, size_t, size_t, void *, uint32_t, const ur_exp_command_buffer_sync_point_t *, diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index f97f8f379c..9f0779b0e8 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -202,9 +202,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != result) { return result; } - - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterGetInfo = urAdapterGetInfo; pDdiTable->pfnAdapterGetLastError = urAdapterGetLastError; @@ -278,17 +275,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; @@ -352,6 +349,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( return result; } + pDdiTable->pfnCooperativeKernelLaunchExp = nullptr; + return UR_RESULT_SUCCESS; } @@ -362,6 +361,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return result; } + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = nullptr; + return UR_RESULT_SUCCESS; } diff --git a/source/adapters/level_zero/adapter.cpp b/source/adapters/level_zero/adapter.cpp index 0a4b71a773..c511d5c8eb 100644 --- a/source/adapters/level_zero/adapter.cpp +++ b/source/adapters/level_zero/adapter.cpp @@ -13,17 +13,6 @@ ur_adapter_handle_t_ Adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL -urInit(ur_device_init_flags_t - DeviceFlags, ///< [in] device initialization flags. - ///< must be 0 (default) or a combination of - ///< ::ur_device_init_flag_t. - ur_loader_config_handle_t) { - std::ignore = DeviceFlags; - - return UR_RESULT_SUCCESS; -} - ur_result_t adapterStateTeardown() { // reclaim ur_platform_handle_t objects here since we don't have // urPlatformRelease. @@ -122,13 +111,6 @@ ur_result_t adapterStateTeardown() { return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urTearDown( - void *Params ///< [in] pointer to tear down parameters -) { - std::ignore = Params; - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet( uint32_t NumEntries, ///< [in] the number of platforms to be added to ///< phAdapters. If phAdapters is not NULL, then diff --git a/source/adapters/level_zero/command_buffer.cpp b/source/adapters/level_zero/command_buffer.cpp index 7ba3cfae4d..e8f3b061f9 100644 --- a/source/adapters/level_zero/command_buffer.cpp +++ b/source/adapters/level_zero/command_buffer.cpp @@ -545,7 +545,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( ur_exp_command_buffer_handle_t CommandBuffer, void *Dst, const void *Src, size_t Size, uint32_t NumSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *SyncPointWaitList, @@ -555,7 +555,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t SrcMem, ur_mem_handle_t DstMem, size_t SrcOffset, size_t DstOffset, size_t Size, uint32_t NumSyncPointsInWaitList, @@ -581,7 +581,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t SrcMem, ur_mem_handle_t DstMem, ur_rect_offset_t SrcOrigin, ur_rect_offset_t DstOrigin, ur_rect_region_t Region, size_t SrcRowPitch, @@ -609,7 +609,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( DstSlicePitch, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, size_t Offset, size_t Size, const void *Src, uint32_t NumSyncPointsInWaitList, @@ -628,7 +628,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( Size, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, ur_rect_offset_t BufferOffset, ur_rect_offset_t HostOffset, ur_rect_region_t Region, size_t BufferRowPitch, size_t BufferSlicePitch, @@ -648,7 +648,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( BufferSlicePitch, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, size_t Offset, size_t Size, void *Dst, uint32_t NumSyncPointsInWaitList, const ur_exp_command_buffer_sync_point_t *SyncPointWaitList, @@ -663,7 +663,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( Size, NumSyncPointsInWaitList, SyncPointWaitList, SyncPoint); } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( ur_exp_command_buffer_handle_t CommandBuffer, ur_mem_handle_t Buffer, ur_rect_offset_t BufferOffset, ur_rect_offset_t HostOffset, ur_rect_region_t Region, size_t BufferRowPitch, size_t BufferSlicePitch, diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index b9b5461e75..94ef529eb4 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -11,6 +11,8 @@ #include #include +namespace { + ur_result_t validateProcInputs(ur_api_version_t version, void *pDdiTable) { if (nullptr == pDdiTable) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; @@ -22,6 +24,11 @@ ur_result_t validateProcInputs(ur_api_version_t version, void *pDdiTable) { } return UR_RESULT_SUCCESS; } +} // namespace + +#if defined(__cplusplus) +extern "C" { +#endif UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( ur_api_version_t version, ///< [in] API version requested @@ -32,9 +39,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != retVal) { return retVal; } - - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; @@ -321,17 +325,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; @@ -438,6 +442,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( return result; } + pDdiTable->pfnCooperativeKernelLaunchExp = nullptr; + return UR_RESULT_SUCCESS; } @@ -448,5 +454,10 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return result; } + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = nullptr; + return UR_RESULT_SUCCESS; } +#if defined(__cplusplus) +} // extern "C" +#endif \ No newline at end of file diff --git a/source/adapters/null/ur_null.cpp b/source/adapters/null/ur_null.cpp index 1a5d0aa373..d79b607ed1 100644 --- a/source/adapters/null/ur_null.cpp +++ b/source/adapters/null/ur_null.cpp @@ -164,25 +164,24 @@ context_t::context_t() { }; ////////////////////////////////////////////////////////////////////////// - urDdiTable.USM.pfnHostAlloc = - [](ur_context_handle_t hContext, const ur_usm_desc_t *pUSMDesc, - ur_usm_pool_handle_t pool, size_t size, void **ppMem) { - if (size == 0) { - *ppMem = nullptr; - return UR_RESULT_ERROR_UNSUPPORTED_SIZE; - } - *ppMem = malloc(size); - if (ppMem == nullptr) { - return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - return UR_RESULT_SUCCESS; - }; + urDdiTable.USM.pfnHostAlloc = [](ur_context_handle_t, const ur_usm_desc_t *, + ur_usm_pool_handle_t, size_t size, + void **ppMem) { + if (size == 0) { + *ppMem = nullptr; + return UR_RESULT_ERROR_UNSUPPORTED_SIZE; + } + *ppMem = malloc(size); + if (ppMem == nullptr) { + return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + return UR_RESULT_SUCCESS; + }; ////////////////////////////////////////////////////////////////////////// urDdiTable.USM.pfnDeviceAlloc = - [](ur_context_handle_t hContext, ur_device_handle_t hDevice, - const ur_usm_desc_t *pUSMDesc, ur_usm_pool_handle_t pool, - size_t size, void **ppMem) { + [](ur_context_handle_t, ur_device_handle_t, const ur_usm_desc_t *, + ur_usm_pool_handle_t, size_t size, void **ppMem) { if (size == 0) { *ppMem = nullptr; return UR_RESULT_ERROR_UNSUPPORTED_SIZE; @@ -195,16 +194,15 @@ context_t::context_t() { }; ////////////////////////////////////////////////////////////////////////// - urDdiTable.USM.pfnFree = [](ur_context_handle_t hContext, void *pMem) { + urDdiTable.USM.pfnFree = [](ur_context_handle_t, void *pMem) { free(pMem); return UR_RESULT_SUCCESS; }; ////////////////////////////////////////////////////////////////////////// urDdiTable.USM.pfnGetMemAllocInfo = - [](ur_context_handle_t hContext, const void *pMem, - ur_usm_alloc_info_t propName, size_t propSize, void *pPropValue, - size_t *pPropSizeRet) { + [](ur_context_handle_t, const void *pMem, ur_usm_alloc_info_t propName, + size_t, void *pPropValue, size_t *pPropSizeRet) { switch (propName) { case UR_USM_ALLOC_INFO_TYPE: *reinterpret_cast(pPropValue) = diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index 65c5676bf9..f1d710ebb4 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -17,15 +17,6 @@ struct ur_adapter_handle_t_ { ur_adapter_handle_t_ adapter{}; -UR_APIEXPORT ur_result_t UR_APICALL urInit(ur_device_init_flags_t, - ur_loader_config_handle_t) { - return UR_RESULT_SUCCESS; -} - -UR_APIEXPORT ur_result_t UR_APICALL urTearDown(void *) { - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urAdapterGet(uint32_t NumEntries, ur_adapter_handle_t *phAdapters, uint32_t *pNumAdapters) { diff --git a/source/adapters/opencl/command_buffer.cpp b/source/adapters/opencl/command_buffer.cpp index 121a991cbd..6313841121 100644 --- a/source/adapters/opencl/command_buffer.cpp +++ b/source/adapters/opencl/command_buffer.cpp @@ -65,7 +65,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendKernelLaunchExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMMemcpyExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] void *pDst, [[maybe_unused]] const void *pSrc, [[maybe_unused]] size_t size, @@ -79,7 +79,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemcpyUSMExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hSrcMem, [[maybe_unused]] ur_mem_handle_t hDstMem, [[maybe_unused]] size_t srcOffset, @@ -94,7 +94,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hSrcMem, [[maybe_unused]] ur_mem_handle_t hDstMem, @@ -114,7 +114,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] size_t offset, [[maybe_unused]] size_t size, [[maybe_unused]] const void *pSrc, @@ -129,7 +129,22 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteExp( + [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, + [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] size_t offset, + [[maybe_unused]] size_t size, [[maybe_unused]] const void *pSrc, + [[maybe_unused]] uint32_t numSyncPointsInWaitList, + [[maybe_unused]] const ur_exp_command_buffer_sync_point_t + *pSyncPointWaitList, + [[maybe_unused]] ur_exp_command_buffer_sync_point_t *pSyncPoint) { + + cl_adapter::die("Experimental Command-buffer feature is not " + "implemented for OpenCL adapter."); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +UR_APIEXPORT +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] size_t offset, [[maybe_unused]] size_t size, [[maybe_unused]] void *pDst, @@ -144,7 +159,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferReadExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferWriteRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] ur_rect_offset_t bufferOffset, @@ -165,7 +180,7 @@ ur_result_t UR_APICALL urCommandBufferAppendMembufferWriteRectExp( } UR_APIEXPORT -ur_result_t UR_APICALL urCommandBufferAppendMembufferReadRectExp( +ur_result_t UR_APICALL urCommandBufferAppendMemBufferReadRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hBuffer, [[maybe_unused]] ur_rect_offset_t bufferOffset, diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index dfd6ef309c..482d080679 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -201,8 +201,6 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetGlobalProcAddrTable( if (UR_RESULT_SUCCESS != Result) { return Result; } - pDdiTable->pfnInit = urInit; - pDdiTable->pfnTearDown = urTearDown; pDdiTable->pfnAdapterGet = urAdapterGet; pDdiTable->pfnAdapterRelease = urAdapterRelease; pDdiTable->pfnAdapterRetain = urAdapterRetain; @@ -287,17 +285,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetCommandBufferExpProcAddrTable( pDdiTable->pfnReleaseExp = urCommandBufferReleaseExp; pDdiTable->pfnFinalizeExp = urCommandBufferFinalizeExp; pDdiTable->pfnAppendKernelLaunchExp = urCommandBufferAppendKernelLaunchExp; - pDdiTable->pfnAppendMemcpyUSMExp = urCommandBufferAppendMemcpyUSMExp; - pDdiTable->pfnAppendMembufferCopyExp = urCommandBufferAppendMembufferCopyExp; - pDdiTable->pfnAppendMembufferCopyRectExp = - urCommandBufferAppendMembufferCopyRectExp; - pDdiTable->pfnAppendMembufferReadExp = urCommandBufferAppendMembufferReadExp; - pDdiTable->pfnAppendMembufferReadRectExp = - urCommandBufferAppendMembufferReadRectExp; - pDdiTable->pfnAppendMembufferWriteExp = - urCommandBufferAppendMembufferWriteExp; - pDdiTable->pfnAppendMembufferWriteRectExp = - urCommandBufferAppendMembufferWriteRectExp; + pDdiTable->pfnAppendUSMMemcpyExp = urCommandBufferAppendUSMMemcpyExp; + pDdiTable->pfnAppendMemBufferCopyExp = urCommandBufferAppendMemBufferCopyExp; + pDdiTable->pfnAppendMemBufferCopyRectExp = + urCommandBufferAppendMemBufferCopyRectExp; + pDdiTable->pfnAppendMemBufferReadExp = urCommandBufferAppendMemBufferReadExp; + pDdiTable->pfnAppendMemBufferReadRectExp = + urCommandBufferAppendMemBufferReadRectExp; + pDdiTable->pfnAppendMemBufferWriteExp = + urCommandBufferAppendMemBufferWriteExp; + pDdiTable->pfnAppendMemBufferWriteRectExp = + urCommandBufferAppendMemBufferWriteRectExp; pDdiTable->pfnEnqueueExp = urCommandBufferEnqueueExp; return retVal; @@ -388,6 +386,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetEnqueueExpProcAddrTable( return result; } + pDdiTable->pfnCooperativeKernelLaunchExp = nullptr; + return UR_RESULT_SUCCESS; } @@ -398,6 +398,8 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return result; } + pDdiTable->pfnSuggestMaxCooperativeGroupCountExp = nullptr; + return UR_RESULT_SUCCESS; } diff --git a/test/conformance/adapter/runtime_adapter_cuda.match b/test/conformance/adapter/adapter_adapter_cuda.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_cuda.match rename to test/conformance/adapter/adapter_adapter_cuda.match diff --git a/test/conformance/adapter/runtime_adapter_hip.match b/test/conformance/adapter/adapter_adapter_hip.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_hip.match rename to test/conformance/adapter/adapter_adapter_hip.match diff --git a/test/conformance/adapter/runtime_adapter_level_zero.match b/test/conformance/adapter/adapter_adapter_level_zero.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_level_zero.match rename to test/conformance/adapter/adapter_adapter_level_zero.match diff --git a/test/conformance/device/device_adapter_cuda.match b/test/conformance/device/device_adapter_cuda.match index 961e7f591d..e69de29bb2 100644 --- a/test/conformance/device/device_adapter_cuda.match +++ b/test/conformance/device/device_adapter_cuda.match @@ -1,4 +0,0 @@ -urDeviceGetTest.InvalidValueNumEntries -{{OPT}}urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUPPORTED_PARTITIONS -{{OPT}}urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE -{{OPT}}urDeviceGetInfoTest.Success/UR_DEVICE_INFO_VIRTUAL_MEMORY_SUPPORT diff --git a/test/conformance/event/event_adapter_cuda.match b/test/conformance/event/event_adapter_cuda.match index 19f3ddeba0..e40ea36db6 100644 --- a/test/conformance/event/event_adapter_cuda.match +++ b/test/conformance/event/event_adapter_cuda.match @@ -2,4 +2,3 @@ urEventSetCallbackTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ urEventSetCallbackTest.ValidateParameters/NVIDIA_CUDA_BACKEND___{{.*}}_ urEventSetCallbackTest.AllStates/NVIDIA_CUDA_BACKEND___{{.*}}_ urEventSetCallbackTest.EventAlreadyCompleted/NVIDIA_CUDA_BACKEND___{{.*}}_ -urEventSetCallbackNegativeTest.InvalidNullHandle/NVIDIA_CUDA_BACKEND___{{.*}}_ diff --git a/test/conformance/event/event_adapter_hip.match b/test/conformance/event/event_adapter_hip.match index 21532dac49..8682cdf4a6 100644 --- a/test/conformance/event/event_adapter_hip.match +++ b/test/conformance/event/event_adapter_hip.match @@ -2,4 +2,3 @@ urEventSetCallbackTest.Success/AMD_HIP_BACKEND___{{.*}}_ urEventSetCallbackTest.ValidateParameters/AMD_HIP_BACKEND___{{.*}}_ urEventSetCallbackTest.AllStates/AMD_HIP_BACKEND___{{.*}}_ urEventSetCallbackTest.EventAlreadyCompleted/AMD_HIP_BACKEND___{{.*}}_ -urEventSetCallbackNegativeTest.InvalidNullHandle/AMD_HIP_BACKEND___{{.*}}_ diff --git a/test/conformance/memory/memory_adapter_cuda.match b/test/conformance/memory/memory_adapter_cuda.match index 35c3504444..34989bdb3b 100644 --- a/test/conformance/memory/memory_adapter_cuda.match +++ b/test/conformance/memory/memory_adapter_cuda.match @@ -1,8 +1,4 @@ urMemBufferCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ -urMemGetInfoTest.InvalidNullPointerParamValue/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerParamValue/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidNullPointerPropSizeRet/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerPropSizeRet/NVIDIA_CUDA_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_FORMAT {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_ELEMENT_SIZE {{OPT}}urMemImageGetInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_IMAGE_INFO_ROW_PITCH diff --git a/test/conformance/platform/platform_adapter_hip.match b/test/conformance/platform/platform_adapter_hip.match index efd19f8b27..052cc6555c 100644 --- a/test/conformance/platform/platform_adapter_hip.match +++ b/test/conformance/platform/platform_adapter_hip.match @@ -1,4 +1,3 @@ -urPlatformGetTest.InvalidNumEntries urPlatformGetNativeHandleTest.Success urPlatformGetNativeHandleTest.InvalidNullHandlePlatform urPlatformGetNativeHandleTest.InvalidNullPointerNativePlatform diff --git a/test/conformance/queue/queue_adapter_cuda.match b/test/conformance/queue/queue_adapter_cuda.match index f7967fb388..a95ec21e85 100644 --- a/test/conformance/queue/queue_adapter_cuda.match +++ b/test/conformance/queue/queue_adapter_cuda.match @@ -1,4 +1,3 @@ -urQueueCreateTest.InvalidQueueProperties/NVIDIA_CUDA_BACKEND___{{.*}}_ urQueueCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_SIZE diff --git a/test/conformance/queue/queue_adapter_hip.match b/test/conformance/queue/queue_adapter_hip.match index 16166a827c..da80fb871d 100644 --- a/test/conformance/queue/queue_adapter_hip.match +++ b/test/conformance/queue/queue_adapter_hip.match @@ -1,4 +1,3 @@ -urQueueCreateTest.InvalidQueueProperties/AMD_HIP_BACKEND___{{.*}}_ urQueueCreateWithParamTest.SuccessWithProperties/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_FLAG_OUT_OF_ORDER_EXEC_MODE_ENABLE urQueueCreateWithParamTest.SuccessWithProperties/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_FLAG_PROFILING_ENABLE urQueueGetInfoTestWithInfoParam.Success/AMD_HIP_BACKEND___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT diff --git a/test/conformance/queue/urQueueCreate.cpp b/test/conformance/queue/urQueueCreate.cpp index ea7026f0b5..1c5ca6e614 100644 --- a/test/conformance/queue/urQueueCreate.cpp +++ b/test/conformance/queue/urQueueCreate.cpp @@ -71,14 +71,11 @@ TEST_P(urQueueCreateTest, InvalidQueueProperties) { /*.pNext =*/nullptr, /*.flags =*/UR_QUEUE_FLAG_FORCE_UINT32, }; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, - urQueueCreate(context, device, &props, &queue)); -} // Initial value is just not a valid enum { ur_queue_handle_t queue = nullptr; - ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_QUEUE_PROPERTIES, + ASSERT_EQ_RESULT(UR_RESULT_ERROR_INVALID_ENUMERATION, urQueueCreate(context, device, &props, &queue)); } // It should be an error to specify both low/high priorities diff --git a/test/fuzz/README.md b/test/fuzz/README.md index 22213b4dbf..9acc3f57ac 100644 --- a/test/fuzz/README.md +++ b/test/fuzz/README.md @@ -1,6 +1,6 @@ # Corpora for fuzz tests with fixed API calls scenarios Corpora in 'corpus' directory contain UR API calls in a predefined order described below. -All such scenarios begin with single calls to urInit() and urAdapterGet(). +All such scenarios begin with single calls to urLoaderInit() and urAdapterGet(). Corpus files are binary files containing ASCII characters which are interpreted by the test backwards, meaning that bytes are read from the end of the file to the beginning of the file. diff --git a/test/fuzz/urFuzz.cpp b/test/fuzz/urFuzz.cpp index cab9a44dd2..0d24f47516 100644 --- a/test/fuzz/urFuzz.cpp +++ b/test/fuzz/urFuzz.cpp @@ -419,7 +419,7 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { } LoaderConfig config; - ur_result_t res = urInit(0, config.handle); + ur_result_t res = urLoaderInit(0, config.handle); if (res != UR_RESULT_SUCCESS) { return -1; } @@ -438,6 +438,11 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { } } + res = urLoaderTearDown(); + if (res != UR_RESULT_SUCCESS) { + return -1; + } + return 0; } } // namespace fuzz diff --git a/test/loader/platforms/platforms.cpp b/test/loader/platforms/platforms.cpp index 4bb487b12b..01938288a0 100644 --- a/test/loader/platforms/platforms.cpp +++ b/test/loader/platforms/platforms.cpp @@ -18,7 +18,7 @@ using namespace logger; ////////////////////////////////////////////////////////////////////////// -int main(int argc, char *argv[]) { +int main(int, char *[]) { auto out = create_logger("TEST"); ur_result_t status; diff --git a/tools/urinfo/urinfo.cpp b/tools/urinfo/urinfo.cpp index 8002cf186b..d1463ea4fa 100644 --- a/tools/urinfo/urinfo.cpp +++ b/tools/urinfo/urinfo.cpp @@ -26,7 +26,7 @@ struct app { UR_CHECK(urLoaderConfigCreate(&loaderConfig)); UR_CHECK(urLoaderConfigEnableLayer(loaderConfig, "UR_LAYER_FULL_VALIDATION")); - UR_CHECK(urInit(0, loaderConfig)); + UR_CHECK(urLoaderInit(0, loaderConfig)); enumerateDevices(); } @@ -174,7 +174,7 @@ devices which are currently visible in the local execution environment. ~app() { urLoaderConfigRelease(loaderConfig); - urTearDown(nullptr); + urLoaderTearDown(); } }; } // namespace urinfo From 7780bbe82143a370ba01d4bd53144288fd4c3867 Mon Sep 17 00:00:00 2001 From: pbalcer Date: Wed, 15 Nov 2023 14:01:13 +0100 Subject: [PATCH 089/145] [common] add codecov badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 762b4b37e1..1d564903f8 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ [![CodeQL](https://github.com/oneapi-src/unified-runtime/actions/workflows/codeql.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/codeql.yml) [![Bandit](https://github.com/oneapi-src/unified-runtime/actions/workflows/bandit.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/bandit.yml) [![Coverity](https://scan.coverity.com/projects/28213/badge.svg)](https://scan.coverity.com/projects/oneapi-src-unified-runtime) +[![codecov.io](https://codecov.io/github/oneapi-src/unified-runtime/coverage.svg?branch=main)] +(https://codecov.io/github/oneapi-src/unified-runtime?branch=master) From 385e179395d9ce79b4f2721b0a19cc0b82f5c665 Mon Sep 17 00:00:00 2001 From: pbalcer Date: Wed, 15 Nov 2023 14:35:41 +0100 Subject: [PATCH 090/145] [common] fix codecov badge url --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 1d564903f8..d17267ce26 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ [![CodeQL](https://github.com/oneapi-src/unified-runtime/actions/workflows/codeql.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/codeql.yml) [![Bandit](https://github.com/oneapi-src/unified-runtime/actions/workflows/bandit.yml/badge.svg)](https://github.com/oneapi-src/unified-runtime/actions/workflows/bandit.yml) [![Coverity](https://scan.coverity.com/projects/28213/badge.svg)](https://scan.coverity.com/projects/oneapi-src-unified-runtime) -[![codecov.io](https://codecov.io/github/oneapi-src/unified-runtime/coverage.svg?branch=main)] -(https://codecov.io/github/oneapi-src/unified-runtime?branch=master) +[![codecov.io](https://codecov.io/github/oneapi-src/unified-runtime/coverage.svg?branch=main)](https://codecov.io/github/oneapi-src/unified-runtime?branch=master) From c739700ef98bdc6d5b67ce1ae3e43edbffe58700 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Wed, 15 Nov 2023 17:21:46 +0100 Subject: [PATCH 091/145] [UR] Fix util_atomic_load_acquire implementation for windows it was assinging destination to the destination ingoring the source... --- source/common/unified_malloc_framework/src/utils/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common/unified_malloc_framework/src/utils/utils.h b/source/common/unified_malloc_framework/src/utils/utils.h index 4dd779c57b..32d499787b 100644 --- a/source/common/unified_malloc_framework/src/utils/utils.h +++ b/source/common/unified_malloc_framework/src/utils/utils.h @@ -43,7 +43,7 @@ static __inline unsigned char util_mssb_index(long long value) { // There is no good way to do atomic_load on windows... #define util_atomic_load_acquire(object, dest) \ do { \ - *dest = InterlockedOr64Acquire((LONG64 volatile *)dest, 0); \ + *dest = InterlockedOr64Acquire((LONG64 volatile *)object, 0); \ } while (0) #define util_atomic_store_release(object, desired) \ From ef109b24d494127596febad36496dcaf12da4f76 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Wed, 15 Nov 2023 17:23:27 +0100 Subject: [PATCH 092/145] [UR] Fix overflow in critnib on Windows 1UL is 4 bytes on windows causing wrong results with bit mask --- source/common/unified_malloc_framework/src/critnib/critnib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/unified_malloc_framework/src/critnib/critnib.c b/source/common/unified_malloc_framework/src/critnib/critnib.c index 8a11a9c3f5..71a589d5dc 100644 --- a/source/common/unified_malloc_framework/src/critnib/critnib.c +++ b/source/common/unified_malloc_framework/src/critnib/critnib.c @@ -81,7 +81,7 @@ #define DELETED_LIFE 16 #define SLICE 4 -#define NIB ((1UL << SLICE) - 1) +#define NIB ((1ULL << SLICE) - 1) #define SLNODES (1 << SLICE) typedef uintptr_t word; @@ -156,7 +156,7 @@ static inline bool is_leaf(struct critnib_node *n) { return (word)n & 1; } * internal: to_leaf -- untag a leaf pointer */ static inline struct critnib_leaf *to_leaf(struct critnib_node *n) { - return (void *)((word)n & ~1UL); + return (void *)((word)n & ~1ULL); } /* From ef13eb82a68d891ba25e2addb5b7d0ff11641e70 Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Thu, 16 Nov 2023 15:37:46 +0000 Subject: [PATCH 093/145] Update Error Handling documentation wording. --- scripts/core/INTRO.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/core/INTRO.rst b/scripts/core/INTRO.rst index 255fe84e50..d557193ef0 100644 --- a/scripts/core/INTRO.rst +++ b/scripts/core/INTRO.rst @@ -66,7 +66,7 @@ The following design philosophies are adopted to reduce Host-side overhead: + This should be handled by validation layer(s) - - By default, neither the driver nor device provide may provide any protection against the following: + - By default, the driver or device may not provide any protection against the following: + Invalid API programming + Invalid function arguments From 2652a77ca5943ac161941273fdfc38b1519cae7f Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Thu, 16 Nov 2023 16:56:00 +0000 Subject: [PATCH 094/145] Ifdef HIP 5.6 entry point --- source/adapters/hip/memory.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 3083d47744..ca4649c9de 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -274,7 +274,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; - UR_CHECK_ERROR(hipArray3DGetDescriptor(&ArrayDescriptor, Mem.Array)); +#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 + UR_CHECK_ERROR( + hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); +#else + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +#endif const auto PixelSizeBytes = GetHipFormatPixelSize(ArrayDescriptor.Format) * ArrayDescriptor.NumChannels; @@ -535,10 +540,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory, UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); try { - HIP_ARRAY3D_DESCRIPTOR ArrayInfo; +#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 UR_CHECK_ERROR(hipArray3DGetDescriptor( - &ArrayInfo, std::get(hMemory->Mem).Array)); + &ArrayInfo, std::get(hMemory->Mem).getArray())); +#else + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +#endif const auto hip2urFormat = [](hipArray_Format HipFormat) -> ur_image_channel_type_t { From 686b3d719f4b05392164547f86a538533370f6ec Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Fri, 17 Nov 2023 08:46:27 +0000 Subject: [PATCH 095/145] Change to HIP_VERSION macro --- source/adapters/hip/memory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index ca4649c9de..0a29e58c27 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -274,7 +274,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; -#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 +#if HIP_VERSION >= 50600000 UR_CHECK_ERROR( hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); #else @@ -541,7 +541,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory, try { HIP_ARRAY3D_DESCRIPTOR ArrayInfo; -#if HIP_VERSION_MAJOR >= 5 && HIP_VERSION_MINOR >= 6 +#if HIP_VERSION >= 50600000 UR_CHECK_ERROR(hipArray3DGetDescriptor( &ArrayInfo, std::get(hMemory->Mem).getArray())); #else From 21e7c46d8bb9b2452dc0df86a06022cac3718b4d Mon Sep 17 00:00:00 2001 From: Omar Ahmed Date: Thu, 16 Nov 2023 12:17:40 +0000 Subject: [PATCH 096/145] Add merge fixes for adapters third bump --- include/ur_print.hpp | 6 ------ scripts/templates/print.hpp.mako | 6 ------ source/adapters/adapter.def.in | 1 + source/adapters/adapter.map.in | 1 + source/adapters/cuda/ur_interface_loader.cpp | 14 ++++++++++++++ source/adapters/hip/ur_interface_loader.cpp | 14 ++++++++++++++ .../adapters/level_zero/ur_interface_loader.cpp | 14 ++++++++++++++ .../adapters/native_cpu/ur_interface_loader.cpp | 14 ++++++++++++++ source/adapters/opencl/event.cpp | 6 +++--- source/adapters/opencl/ur_interface_loader.cpp | 13 +++++++++++++ source/common/logger/ur_sinks.hpp | 1 - test/conformance/device/device_adapter_hip.match | 5 +---- .../enqueue/enqueue_adapter_level_zero.match | 3 ++- .../kernel/kernel_adapter_level_zero.match | 15 +++++++++++++++ test/conformance/memory/memory_adapter_hip.match | 4 ---- .../memory/memory_adapter_level_zero.match | 4 ---- test/conformance/queue/queue_adapter_cuda.match | 3 --- test/loader/loader_lifetime/urLoaderInit.cpp | 2 +- test/unit/utils/params.cpp | 1 - tools/urinfo/utils.hpp | 2 +- tools/urtrace/collector.cpp | 2 +- 21 files changed, 95 insertions(+), 36 deletions(-) diff --git a/include/ur_print.hpp b/include/ur_print.hpp index f779e95f2b..a1bc7e55d7 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -17,8 +17,6 @@ #include #include -namespace ur { -namespace print { namespace details { template struct is_handle : std::false_type {}; @@ -15865,7 +15863,6 @@ inline ur_result_t printPtr(std::ostream &os, const T *ptr) { return UR_RESULT_SUCCESS; } } // namespace details -} // namespace print namespace extras { /////////////////////////////////////////////////////////////////////////////// @@ -15876,8 +15873,6 @@ namespace extras { /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// - `NULL == params` UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { - using namespace print; - if (!params) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } @@ -16441,6 +16436,5 @@ UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, return UR_RESULT_SUCCESS; } } // namespace extras -} // namespace ur #endif /* UR_PRINT_HPP */ diff --git a/scripts/templates/print.hpp.mako b/scripts/templates/print.hpp.mako index b4976eaf6b..d78731a625 100644 --- a/scripts/templates/print.hpp.mako +++ b/scripts/templates/print.hpp.mako @@ -108,8 +108,6 @@ def findMemberType(_item): %endif -namespace ${x} { -namespace print { ## API functions declarations ################################################# namespace details { template struct is_handle : std::false_type {}; @@ -436,7 +434,6 @@ template inline ${x}_result_t printPtr(std::ostream &os, const T *p return ${X}_RESULT_SUCCESS; } } // namespace details -} // namespace print namespace extras { /////////////////////////////////////////////////////////////////////////////// @@ -447,8 +444,6 @@ namespace extras { /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - `NULL == params` ${X}_APIEXPORT inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { - using namespace print; - if (!params) { return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; } @@ -466,6 +461,5 @@ ${X}_APIEXPORT inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostrea return ${X}_RESULT_SUCCESS; } } // namespace extras -} // namespace ${x} #endif /* ${X}_PRINT_HPP */ diff --git a/source/adapters/adapter.def.in b/source/adapters/adapter.def.in index 69706127f5..3c18c78bd1 100644 --- a/source/adapters/adapter.def.in +++ b/source/adapters/adapter.def.in @@ -13,6 +13,7 @@ EXPORTS urGetPhysicalMemProcAddrTable urGetPlatformProcAddrTable urGetProgramProcAddrTable + urGetProgramExpProcAddrTable urGetQueueProcAddrTable urGetSamplerProcAddrTable urGetUSMProcAddrTable diff --git a/source/adapters/adapter.map.in b/source/adapters/adapter.map.in index 902c0aec69..bb08ae7d88 100644 --- a/source/adapters/adapter.map.in +++ b/source/adapters/adapter.map.in @@ -13,6 +13,7 @@ urGetPhysicalMemProcAddrTable; urGetPlatformProcAddrTable; urGetProgramProcAddrTable; + urGetProgramExpProcAddrTable; urGetQueueProcAddrTable; urGetSamplerProcAddrTable; urGetUSMProcAddrTable; diff --git a/source/adapters/cuda/ur_interface_loader.cpp b/source/adapters/cuda/ur_interface_loader.cpp index 0a5dd5a04f..b919e9bd88 100644 --- a/source/adapters/cuda/ur_interface_loader.cpp +++ b/source/adapters/cuda/ur_interface_loader.cpp @@ -412,6 +412,20 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return UR_RESULT_SUCCESS; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ur_program_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + pDdiTable->pfnBuildExp = nullptr; + pDdiTable->pfnCompileExp = nullptr; + pDdiTable->pfnLinkExp = nullptr; + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index 88d2b64a3b..937ef4d3dc 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -366,6 +366,20 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return UR_RESULT_SUCCESS; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ur_program_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + pDdiTable->pfnBuildExp = nullptr; + pDdiTable->pfnCompileExp = nullptr; + pDdiTable->pfnLinkExp = nullptr; + + return UR_RESULT_SUCCESS; +} + #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/adapters/level_zero/ur_interface_loader.cpp b/source/adapters/level_zero/ur_interface_loader.cpp index 94ef529eb4..4bee4375ff 100644 --- a/source/adapters/level_zero/ur_interface_loader.cpp +++ b/source/adapters/level_zero/ur_interface_loader.cpp @@ -458,6 +458,20 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return UR_RESULT_SUCCESS; } + +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ur_program_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + pDdiTable->pfnBuildExp = nullptr; + pDdiTable->pfnCompileExp = nullptr; + pDdiTable->pfnLinkExp = nullptr; + + return UR_RESULT_SUCCESS; +} #if defined(__cplusplus) } // extern "C" #endif \ No newline at end of file diff --git a/source/adapters/native_cpu/ur_interface_loader.cpp b/source/adapters/native_cpu/ur_interface_loader.cpp index 5ca99caae3..7c4f593f88 100644 --- a/source/adapters/native_cpu/ur_interface_loader.cpp +++ b/source/adapters/native_cpu/ur_interface_loader.cpp @@ -401,4 +401,18 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return UR_RESULT_SUCCESS; } + +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ur_program_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + pDdiTable->pfnBuildExp = nullptr; + pDdiTable->pfnCompileExp = nullptr; + pDdiTable->pfnLinkExp = nullptr; + + return UR_RESULT_SUCCESS; +} } // extern "C" diff --git a/source/adapters/opencl/event.cpp b/source/adapters/opencl/event.cpp index 87f1f58f1a..d180cfb097 100644 --- a/source/adapters/opencl/event.cpp +++ b/source/adapters/opencl/event.cpp @@ -220,13 +220,13 @@ urEventSetCallback(ur_event_handle_t hEvent, ur_execution_info_t execStatus, cl_int CallbackType = 0; switch (execStatus) { - case UR_EXECUTION_INFO_EXECUTION_INFO_SUBMITTED: + case UR_EXECUTION_INFO_SUBMITTED: CallbackType = CL_SUBMITTED; break; - case UR_EXECUTION_INFO_EXECUTION_INFO_RUNNING: + case UR_EXECUTION_INFO_RUNNING: CallbackType = CL_RUNNING; break; - case UR_EXECUTION_INFO_EXECUTION_INFO_COMPLETE: + case UR_EXECUTION_INFO_COMPLETE: CallbackType = CL_COMPLETE; break; default: diff --git a/source/adapters/opencl/ur_interface_loader.cpp b/source/adapters/opencl/ur_interface_loader.cpp index 482d080679..9186646093 100644 --- a/source/adapters/opencl/ur_interface_loader.cpp +++ b/source/adapters/opencl/ur_interface_loader.cpp @@ -403,6 +403,19 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetKernelExpProcAddrTable( return UR_RESULT_SUCCESS; } +UR_DLLEXPORT ur_result_t UR_APICALL urGetProgramExpProcAddrTable( + ur_api_version_t version, ur_program_exp_dditable_t *pDdiTable) { + auto result = validateProcInputs(version, pDdiTable); + if (UR_RESULT_SUCCESS != result) { + return result; + } + + pDdiTable->pfnBuildExp = nullptr; + pDdiTable->pfnCompileExp = nullptr; + pDdiTable->pfnLinkExp = nullptr; + + return UR_RESULT_SUCCESS; +} #if defined(__cplusplus) } // extern "C" #endif diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index 925a5acc9a..cb8c751e4d 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -16,7 +16,6 @@ #include "ur_print.hpp" namespace logger { -using namespace ur::print; class Sink { public: diff --git a/test/conformance/device/device_adapter_hip.match b/test/conformance/device/device_adapter_hip.match index 711bfe1224..1e498301c8 100644 --- a/test/conformance/device/device_adapter_hip.match +++ b/test/conformance/device/device_adapter_hip.match @@ -1,5 +1,2 @@ -urDeviceCreateWithNativeHandleTest.Success -urDeviceGetTest.InvalidValueNumEntries +{{OPT}}urDeviceCreateWithNativeHandleTest.Success {{OPT}}urDeviceGetGlobalTimestampTest.SuccessSynchronizedTime -urDeviceGetInfoTest.Success/UR_DEVICE_INFO_SUPPORTED_PARTITIONS -urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE diff --git a/test/conformance/enqueue/enqueue_adapter_level_zero.match b/test/conformance/enqueue/enqueue_adapter_level_zero.match index cef0029dc7..0290c664eb 100644 --- a/test/conformance/enqueue/enqueue_adapter_level_zero.match +++ b/test/conformance/enqueue/enqueue_adapter_level_zero.match @@ -1,2 +1,3 @@ {{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -Segmentation fault +{{OPT}}urEnqueueEventsWaitTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +{{Segmentation fault|Aborted}} diff --git a/test/conformance/kernel/kernel_adapter_level_zero.match b/test/conformance/kernel/kernel_adapter_level_zero.match index 7a1c0d5b8e..75b58b6d48 100644 --- a/test/conformance/kernel/kernel_adapter_level_zero.match +++ b/test/conformance/kernel/kernel_adapter_level_zero.match @@ -1 +1,16 @@ +urKernelGetInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_NUM_REGS +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_FUNCTION_NAME +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_NUM_ARGS +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_REFERENCE_COUNT +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_CONTEXT +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_PROGRAM +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_ATTRIBUTES +urKernelGetInfoTest.InvalidSizeSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_KERNEL_INFO_NUM_REGS +urKernelSetArgLocalTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgMemObjTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgPointerTest.SuccessHost/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgPointerTest.SuccessDevice/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgPointerTest.SuccessShared/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgPointerNegativeTest.InvalidNullHandleKernel/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgPointerNegativeTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ Segmentation fault diff --git a/test/conformance/memory/memory_adapter_hip.match b/test/conformance/memory/memory_adapter_hip.match index c6d4bdacfe..a4ae7d4f8a 100644 --- a/test/conformance/memory/memory_adapter_hip.match +++ b/test/conformance/memory/memory_adapter_hip.match @@ -1,8 +1,4 @@ urMemBufferCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}}_ -urMemGetInfoTest.InvalidNullPointerParamValue/AMD_HIP_BACKEND___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerParamValue/AMD_HIP_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidNullPointerPropSizeRet/AMD_HIP_BACKEND___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerPropSizeRet/AMD_HIP_BACKEND___{{.*}}___UR_MEM_INFO_CONTEXT {{OPT}}urMemImageCreateTest.InvalidSize/AMD_HIP_BACKEND___{{.*}}_ {{OPT}}urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_IMAGE_INFO_ROW_PITCH {{OPT}}urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_IMAGE_INFO_SLICE_PITCH diff --git a/test/conformance/memory/memory_adapter_level_zero.match b/test/conformance/memory/memory_adapter_level_zero.match index 00b085926f..ff51b24b4b 100644 --- a/test/conformance/memory/memory_adapter_level_zero.match +++ b/test/conformance/memory/memory_adapter_level_zero.match @@ -2,9 +2,5 @@ urMemBufferCreateTest.InvalidBufferSizeZero/Intel_R__oneAPI_Unified_Runtime_over urMemBufferPartitionTest.InvalidBufferSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueCreateType/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urMemBufferPartitionTest.InvalidValueBufferCreateInfoOutOfBounds/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_CONTEXT urMemGetInfoImageTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_MEM_INFO_SIZE {{Segmentation fault|Aborted}} diff --git a/test/conformance/queue/queue_adapter_cuda.match b/test/conformance/queue/queue_adapter_cuda.match index a95ec21e85..e69de29bb2 100644 --- a/test/conformance/queue/queue_adapter_cuda.match +++ b/test/conformance/queue/queue_adapter_cuda.match @@ -1,3 +0,0 @@ -urQueueCreateWithNativeHandleTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ -urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT -urQueueGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_QUEUE_INFO_SIZE diff --git a/test/loader/loader_lifetime/urLoaderInit.cpp b/test/loader/loader_lifetime/urLoaderInit.cpp index 693cf273f2..6939333d5a 100644 --- a/test/loader/loader_lifetime/urLoaderInit.cpp +++ b/test/loader/loader_lifetime/urLoaderInit.cpp @@ -17,7 +17,7 @@ INSTANTIATE_TEST_SUITE_P( UR_DEVICE_INIT_FLAG_FPGA | UR_DEVICE_INIT_FLAG_VPU), [](const ::testing::TestParamInfo &info) { std::stringstream ss; - ur::print::details::printFlag(ss, info.param); + details::printFlag(ss, info.param); return GTestSanitizeString(ss.str()); }); diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index 82a7d946d4..007047e25a 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -405,7 +405,6 @@ typedef Types #include #include diff --git a/tools/urtrace/collector.cpp b/tools/urtrace/collector.cpp index a78cb82d08..8c7770ba57 100644 --- a/tools/urtrace/collector.cpp +++ b/tools/urtrace/collector.cpp @@ -331,7 +331,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, if (cli_args.no_args) { args_str << "..."; } else { - ur::extras::printFunctionParams( + extras::printFunctionParams( args_str, (enum ur_function_t)args->function_id, args->args_data); } From 23005313745cfb36d77f1e7300878166ab38f7be Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Fri, 17 Nov 2023 11:44:51 +0000 Subject: [PATCH 097/145] Fix formatting. --- source/adapters/opencl/command_buffer.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/adapters/opencl/command_buffer.cpp b/source/adapters/opencl/command_buffer.cpp index a3c4ef29b1..a4506bed3c 100644 --- a/source/adapters/opencl/command_buffer.cpp +++ b/source/adapters/opencl/command_buffer.cpp @@ -164,8 +164,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyExp( return UR_RESULT_ERROR_INVALID_OPERATION; CL_RETURN_ON_FAILURE(clCommandCopyBufferKHR( - hCommandBuffer->CLCommandBuffer, - nullptr, + hCommandBuffer->CLCommandBuffer, nullptr, cl_adapter::cast(hSrcMem), cl_adapter::cast(hDstMem), srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint, nullptr)); @@ -197,8 +196,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferCopyRectExp( return UR_RESULT_ERROR_INVALID_OPERATION; CL_RETURN_ON_FAILURE(clCommandCopyBufferRectKHR( - hCommandBuffer->CLCommandBuffer, - nullptr, + hCommandBuffer->CLCommandBuffer, nullptr, cl_adapter::cast(hSrcMem), cl_adapter::cast(hDstMem), OpenCLOriginRect, OpenCLDstRect, OpenCLRegion, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numSyncPointsInWaitList, pSyncPointWaitList, @@ -284,8 +282,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMembufferFillExp( return UR_RESULT_ERROR_INVALID_OPERATION; CL_RETURN_ON_FAILURE(clCommandFillBufferKHR( - hCommandBuffer->CLCommandBuffer, - nullptr, + hCommandBuffer->CLCommandBuffer, nullptr, cl_adapter::cast(hBuffer), pPattern, patternSize, offset, size, numSyncPointsInWaitList, pSyncPointWaitList, pSyncPoint, nullptr)); From 5ef979b20938fefe451cc671fb1ce49e0c8b3ad8 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Mon, 20 Nov 2023 12:23:50 +0000 Subject: [PATCH 098/145] Correctly implement reference counting for Native CPU --- source/adapters/native_cpu/context.cpp | 4 +++- source/adapters/native_cpu/context.hpp | 3 ++- source/adapters/native_cpu/kernel.cpp | 4 +++- source/adapters/native_cpu/program.cpp | 4 +++- source/adapters/native_cpu/queue.cpp | 8 ++++++-- source/adapters/native_cpu/queue.hpp | 3 ++- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/source/adapters/native_cpu/context.cpp b/source/adapters/native_cpu/context.cpp index e8732646f5..9cceeb4551 100644 --- a/source/adapters/native_cpu/context.cpp +++ b/source/adapters/native_cpu/context.cpp @@ -38,7 +38,9 @@ urContextRetain(ur_context_handle_t hContext) { UR_APIEXPORT ur_result_t UR_APICALL urContextRelease(ur_context_handle_t hContext) { - delete hContext; + hContext->decrementReferenceCount(); + if(hContext->getReferenceCount() == 0) + delete hContext; return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/context.hpp b/source/adapters/native_cpu/context.hpp index 04404d7988..465c4a8c8c 100644 --- a/source/adapters/native_cpu/context.hpp +++ b/source/adapters/native_cpu/context.hpp @@ -13,8 +13,9 @@ #include #include "device.hpp" +#include "common.hpp" -struct ur_context_handle_t_ { +struct ur_context_handle_t_ : RefCounted { ur_context_handle_t_(ur_device_handle_t_ *phDevices) : _device{phDevices} {} ur_device_handle_t _device; diff --git a/source/adapters/native_cpu/kernel.cpp b/source/adapters/native_cpu/kernel.cpp index 96648e57f8..67826a7d61 100644 --- a/source/adapters/native_cpu/kernel.cpp +++ b/source/adapters/native_cpu/kernel.cpp @@ -182,7 +182,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelRetain(ur_kernel_handle_t hKernel) { UR_APIEXPORT ur_result_t UR_APICALL urKernelRelease(ur_kernel_handle_t hKernel) { - delete hKernel; + hKernel->decrementReferenceCount(); + if(hKernel->getReferenceCount() == 0) + delete hKernel; return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/program.cpp b/source/adapters/native_cpu/program.cpp index 389626fa70..f48b9d25f2 100644 --- a/source/adapters/native_cpu/program.cpp +++ b/source/adapters/native_cpu/program.cpp @@ -95,7 +95,9 @@ urProgramRetain(ur_program_handle_t hProgram) { UR_APIEXPORT ur_result_t UR_APICALL urProgramRelease(ur_program_handle_t hProgram) { - delete hProgram; + hProgram->decrementReferenceCount(); + if(hProgram->getReferenceCount() == 0) + delete hProgram; return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/queue.cpp b/source/adapters/native_cpu/queue.cpp index d4e85ce989..1680b076a9 100644 --- a/source/adapters/native_cpu/queue.cpp +++ b/source/adapters/native_cpu/queue.cpp @@ -43,12 +43,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate( UR_APIEXPORT ur_result_t UR_APICALL urQueueRetain(ur_queue_handle_t hQueue) { std::ignore = hQueue; + hQueue->incrementReferenceCount(); - DIE_NO_IMPLEMENTATION; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease(ur_queue_handle_t hQueue) { - delete hQueue; + hQueue->decrementReferenceCount(); + if(hQueue->getReferenceCount() == 0) + delete hQueue; + return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/queue.hpp b/source/adapters/native_cpu/queue.hpp index 0c7d812496..5e9039dd24 100644 --- a/source/adapters/native_cpu/queue.hpp +++ b/source/adapters/native_cpu/queue.hpp @@ -8,5 +8,6 @@ // //===----------------------------------------------------------------------===// #pragma once +#include "common.hpp" -struct ur_queue_handle_t_ {}; +struct ur_queue_handle_t_ : RefCounted {}; From ca374bc8969e4dac2fe3ce5234900a5319d6a336 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Mon, 20 Nov 2023 13:12:40 +0000 Subject: [PATCH 099/145] use common helper --- source/adapters/native_cpu/common.hpp | 10 ++++++++++ source/adapters/native_cpu/context.cpp | 8 +++----- source/adapters/native_cpu/kernel.cpp | 4 +--- source/adapters/native_cpu/program.cpp | 5 +---- source/adapters/native_cpu/queue.cpp | 4 +--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/source/adapters/native_cpu/common.hpp b/source/adapters/native_cpu/common.hpp index 36ae7abd8b..2c1f48e4d0 100644 --- a/source/adapters/native_cpu/common.hpp +++ b/source/adapters/native_cpu/common.hpp @@ -11,6 +11,7 @@ #pragma once #include "ur/ur.hpp" +#include constexpr size_t MaxMessageSize = 256; @@ -63,8 +64,17 @@ struct _ur_object { struct RefCounted { std::atomic_uint32_t _refCount; + std::mutex _mutex; void incrementReferenceCount() { _refCount++; } void decrementReferenceCount() { _refCount--; } RefCounted() : _refCount{1} {} uint32_t getReferenceCount() const { return _refCount; } }; + +template +inline void decrementOrDelete(T* refC) { + refC->decrementReferenceCount(); + std::lock_guard lock(refC->_mutex); + if (refC->getReferenceCount() == 0) + delete refC; +} diff --git a/source/adapters/native_cpu/context.cpp b/source/adapters/native_cpu/context.cpp index 9cceeb4551..962525d1fc 100644 --- a/source/adapters/native_cpu/context.cpp +++ b/source/adapters/native_cpu/context.cpp @@ -32,15 +32,13 @@ urContextCreate(uint32_t DeviceCount, const ur_device_handle_t *phDevices, UR_APIEXPORT ur_result_t UR_APICALL urContextRetain(ur_context_handle_t hContext) { - std::ignore = hContext; - DIE_NO_IMPLEMENTATION + hContext->incrementReferenceCount(); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urContextRelease(ur_context_handle_t hContext) { - hContext->decrementReferenceCount(); - if(hContext->getReferenceCount() == 0) - delete hContext; + decrementOrDelete(hContext); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/kernel.cpp b/source/adapters/native_cpu/kernel.cpp index 67826a7d61..7a5c6be308 100644 --- a/source/adapters/native_cpu/kernel.cpp +++ b/source/adapters/native_cpu/kernel.cpp @@ -182,9 +182,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelRetain(ur_kernel_handle_t hKernel) { UR_APIEXPORT ur_result_t UR_APICALL urKernelRelease(ur_kernel_handle_t hKernel) { - hKernel->decrementReferenceCount(); - if(hKernel->getReferenceCount() == 0) - delete hKernel; + decrementOrDelete(hKernel); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/program.cpp b/source/adapters/native_cpu/program.cpp index f48b9d25f2..f55f7b7fa6 100644 --- a/source/adapters/native_cpu/program.cpp +++ b/source/adapters/native_cpu/program.cpp @@ -95,10 +95,7 @@ urProgramRetain(ur_program_handle_t hProgram) { UR_APIEXPORT ur_result_t UR_APICALL urProgramRelease(ur_program_handle_t hProgram) { - hProgram->decrementReferenceCount(); - if(hProgram->getReferenceCount() == 0) - delete hProgram; - + decrementOrDelete(hProgram); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/native_cpu/queue.cpp b/source/adapters/native_cpu/queue.cpp index 1680b076a9..516e66db64 100644 --- a/source/adapters/native_cpu/queue.cpp +++ b/source/adapters/native_cpu/queue.cpp @@ -49,9 +49,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueRetain(ur_queue_handle_t hQueue) { } UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease(ur_queue_handle_t hQueue) { - hQueue->decrementReferenceCount(); - if(hQueue->getReferenceCount() == 0) - delete hQueue; + decrementOrDelete(hQueue); return UR_RESULT_SUCCESS; } From bffa67de6b1a0087eb62fe1ddce6c5ebb43bd62e Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Mon, 20 Nov 2023 13:31:06 +0000 Subject: [PATCH 100/145] Remove mutex --- source/adapters/native_cpu/common.hpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/adapters/native_cpu/common.hpp b/source/adapters/native_cpu/common.hpp index 2c1f48e4d0..22dfe8220c 100644 --- a/source/adapters/native_cpu/common.hpp +++ b/source/adapters/native_cpu/common.hpp @@ -11,7 +11,6 @@ #pragma once #include "ur/ur.hpp" -#include constexpr size_t MaxMessageSize = 256; @@ -64,7 +63,6 @@ struct _ur_object { struct RefCounted { std::atomic_uint32_t _refCount; - std::mutex _mutex; void incrementReferenceCount() { _refCount++; } void decrementReferenceCount() { _refCount--; } RefCounted() : _refCount{1} {} @@ -74,7 +72,6 @@ struct RefCounted { template inline void decrementOrDelete(T* refC) { refC->decrementReferenceCount(); - std::lock_guard lock(refC->_mutex); if (refC->getReferenceCount() == 0) delete refC; } From 413de311138fb9d0d570230b0ee3d4ff9d32be5b Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Tue, 21 Nov 2023 11:12:06 +0000 Subject: [PATCH 101/145] Formatting --- source/adapters/native_cpu/common.hpp | 3 +-- source/adapters/native_cpu/context.hpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/source/adapters/native_cpu/common.hpp b/source/adapters/native_cpu/common.hpp index 22dfe8220c..9647fdbf24 100644 --- a/source/adapters/native_cpu/common.hpp +++ b/source/adapters/native_cpu/common.hpp @@ -69,8 +69,7 @@ struct RefCounted { uint32_t getReferenceCount() const { return _refCount; } }; -template -inline void decrementOrDelete(T* refC) { +template inline void decrementOrDelete(T *refC) { refC->decrementReferenceCount(); if (refC->getReferenceCount() == 0) delete refC; diff --git a/source/adapters/native_cpu/context.hpp b/source/adapters/native_cpu/context.hpp index 465c4a8c8c..30bfb31d71 100644 --- a/source/adapters/native_cpu/context.hpp +++ b/source/adapters/native_cpu/context.hpp @@ -12,8 +12,8 @@ #include -#include "device.hpp" #include "common.hpp" +#include "device.hpp" struct ur_context_handle_t_ : RefCounted { ur_context_handle_t_(ur_device_handle_t_ *phDevices) : _device{phDevices} {} From 841a2870ab024d850e4c11405c0891e89d3a8569 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 9 Oct 2023 10:58:25 +0100 Subject: [PATCH 102/145] Revert add prefetch for USM hip allocations a6b8fa66b537753415d24076f1025c040110c332 --- source/adapters/hip/context.hpp | 53 --------------------------------- source/adapters/hip/enqueue.cpp | 11 +------ source/adapters/hip/kernel.cpp | 2 +- source/adapters/hip/kernel.hpp | 15 ---------- 4 files changed, 2 insertions(+), 79 deletions(-) diff --git a/source/adapters/hip/context.hpp b/source/adapters/hip/context.hpp index 8191a05408..d8d0f5d304 100644 --- a/source/adapters/hip/context.hpp +++ b/source/adapters/hip/context.hpp @@ -10,7 +10,6 @@ #pragma once #include -#include #include "common.hpp" #include "device.hpp" @@ -106,61 +105,9 @@ struct ur_context_handle_t_ { ur_usm_pool_handle_t getOwningURPool(umf_memory_pool_t *UMFPool); - /// We need to keep track of USM mappings in AMD HIP, as certain extra - /// synchronization *is* actually required for correctness. - /// During kernel enqueue we must dispatch a prefetch for each kernel argument - /// that points to a USM mapping to ensure the mapping is correctly - /// populated on the device (https://github.com/intel/llvm/issues/7252). Thus, - /// we keep track of mappings in the context, and then check against them just - /// before the kernel is launched. The stream against which the kernel is - /// launched is not known until enqueue time, but the USM mappings can happen - /// at any time. Thus, they are tracked on the context used for the urUSM* - /// mapping. - /// - /// The three utility function are simple wrappers around a mapping from a - /// pointer to a size. - void addUSMMapping(void *Ptr, size_t Size) { - std::lock_guard Guard(Mutex); - assert(USMMappings.find(Ptr) == USMMappings.end() && - "mapping already exists"); - USMMappings[Ptr] = Size; - } - - void removeUSMMapping(const void *Ptr) { - std::lock_guard guard(Mutex); - auto It = USMMappings.find(Ptr); - if (It != USMMappings.end()) - USMMappings.erase(It); - } - - std::pair getUSMMapping(const void *Ptr) { - std::lock_guard Guard(Mutex); - auto It = USMMappings.find(Ptr); - // The simple case is the fast case... - if (It != USMMappings.end()) - return *It; - - // ... but in the failure case we have to fall back to a full scan to search - // for "offset" pointers in case the user passes in the middle of an - // allocation. We have to do some not-so-ordained-by-the-standard ordered - // comparisons of pointers here, but it'll work on all platforms we support. - uintptr_t PtrVal = (uintptr_t)Ptr; - for (std::pair Pair : USMMappings) { - uintptr_t BaseAddr = (uintptr_t)Pair.first; - uintptr_t EndAddr = BaseAddr + Pair.second; - if (PtrVal > BaseAddr && PtrVal < EndAddr) { - // If we've found something now, offset *must* be nonzero - assert(Pair.second); - return Pair; - } - } - return {nullptr, 0}; - } - private: std::mutex Mutex; std::vector ExtendedDeleters; - std::unordered_map USMMappings; std::set PoolHandles; }; diff --git a/source/adapters/hip/enqueue.cpp b/source/adapters/hip/enqueue.cpp index 95292ad00d..1a73618c77 100644 --- a/source/adapters/hip/enqueue.cpp +++ b/source/adapters/hip/enqueue.cpp @@ -258,7 +258,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( try { ur_device_handle_t Dev = hQueue->getDevice(); ScopedContext Active(Dev); - ur_context_handle_t Ctx = hQueue->getContext(); uint32_t StreamToken; ur_stream_quard Guard; @@ -266,14 +265,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( numEventsInWaitList, phEventWaitList, Guard, &StreamToken); hipFunction_t HIPFunc = hKernel->get(); - hipDevice_t HIPDev = Dev->get(); - for (const void *P : hKernel->getPtrArgs()) { - auto [Addr, Size] = Ctx->getUSMMapping(P); - if (!Addr) - continue; - if (hipMemPrefetchAsync(Addr, Size, HIPDev, HIPStream) != hipSuccess) - return UR_RESULT_ERROR_INVALID_KERNEL_ARGS; - } Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, phEventWaitList); @@ -315,7 +306,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( int DeviceMaxLocalMem = 0; UR_CHECK_ERROR(hipDeviceGetAttribute( &DeviceMaxLocalMem, hipDeviceAttributeMaxSharedMemoryPerBlock, - HIPDev)); + Dev->get())); static const int EnvVal = std::atoi(LocalMemSzPtr); if (EnvVal <= 0 || EnvVal > DeviceMaxLocalMem) { diff --git a/source/adapters/hip/kernel.cpp b/source/adapters/hip/kernel.cpp index 642743ddbf..cc6f4384bc 100644 --- a/source/adapters/hip/kernel.cpp +++ b/source/adapters/hip/kernel.cpp @@ -259,7 +259,7 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgPointer( ur_kernel_handle_t hKernel, uint32_t argIndex, const ur_kernel_arg_pointer_properties_t *, const void *pArgValue) { - hKernel->setKernelPtrArg(argIndex, sizeof(pArgValue), pArgValue); + hKernel->setKernelArg(argIndex, sizeof(pArgValue), pArgValue); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/hip/kernel.hpp b/source/adapters/hip/kernel.hpp index 3db9dce19a..f13478a69c 100644 --- a/source/adapters/hip/kernel.hpp +++ b/source/adapters/hip/kernel.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include "program.hpp" @@ -58,7 +57,6 @@ struct ur_kernel_handle_t_ { args_size_t ParamSizes; args_index_t Indices; args_size_t OffsetPerIndex; - std::set PtrArgs; std::uint32_t ImplicitOffsetArgs[3] = {0, 0, 0}; @@ -179,19 +177,6 @@ struct ur_kernel_handle_t_ { Args.addArg(Index, Size, Arg); } - /// We track all pointer arguments to be able to issue prefetches at enqueue - /// time - void setKernelPtrArg(int Index, size_t Size, const void *PtrArg) { - Args.PtrArgs.insert(*static_cast(PtrArg)); - setKernelArg(Index, Size, PtrArg); - } - - bool isPtrArg(const void *ptr) { - return Args.PtrArgs.find(ptr) != Args.PtrArgs.end(); - } - - std::set &getPtrArgs() { return Args.PtrArgs; } - void setKernelLocalArg(int Index, size_t Size) { Args.addLocalArg(Index, Size); } From e2f9eb0e989091b6002eb88a83fa29c9719e7c2a Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Thu, 2 Nov 2023 12:48:28 +0000 Subject: [PATCH 103/145] Add missing symbols --- source/adapters/hip/ur_interface_loader.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index 56b00ab273..d0d7e760fb 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -307,6 +307,18 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUsmP2PExpProcAddrTable( return retVal; } +// TODO: Implement +UR_DLLEXPORT ur_result_t UR_APICALL urGetBindlessImagesExpProcAddrTable( + ur_api_version_t, ur_bindless_images_exp_dditable_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + +// TODO: Implement +UR_DLLEXPORT ur_result_t UR_APICALL +urGetUSMExpProcAddrTable(ur_api_version_t, ur_usm_exp_dditable_t *) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +} + UR_DLLEXPORT ur_result_t UR_APICALL urGetVirtualMemProcAddrTable( ur_api_version_t version, ///< [in] API version requested ur_virtual_mem_dditable_t From e413c6caeec872cb32f8d50c2786f4cbdc14fcce Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Fri, 3 Nov 2023 11:24:48 +0000 Subject: [PATCH 104/145] Make return UR_RESULT_SUCCESS --- source/adapters/hip/ur_interface_loader.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/adapters/hip/ur_interface_loader.cpp b/source/adapters/hip/ur_interface_loader.cpp index d0d7e760fb..dd46263afd 100644 --- a/source/adapters/hip/ur_interface_loader.cpp +++ b/source/adapters/hip/ur_interface_loader.cpp @@ -310,13 +310,17 @@ UR_DLLEXPORT ur_result_t UR_APICALL urGetUsmP2PExpProcAddrTable( // TODO: Implement UR_DLLEXPORT ur_result_t UR_APICALL urGetBindlessImagesExpProcAddrTable( ur_api_version_t, ur_bindless_images_exp_dditable_t *) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + // This needs to return UR_RESULT_SUCCESS or else the platform can't be + // initialized + return UR_RESULT_SUCCESS; } // TODO: Implement UR_DLLEXPORT ur_result_t UR_APICALL urGetUSMExpProcAddrTable(ur_api_version_t, ur_usm_exp_dditable_t *) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + // This needs to return UR_RESULT_SUCCESS or else the platform can't be + // initialized + return UR_RESULT_SUCCESS; } UR_DLLEXPORT ur_result_t UR_APICALL urGetVirtualMemProcAddrTable( From 2b77f79e16b41b95ce1ed27a8a9a75b5574ea92a Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Fri, 20 Oct 2023 16:13:17 +0100 Subject: [PATCH 105/145] Don't reinstate old context --- source/adapters/hip/context.hpp | 34 +++++++-------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/source/adapters/hip/context.hpp b/source/adapters/hip/context.hpp index 8191a05408..d3b5fc91d0 100644 --- a/source/adapters/hip/context.hpp +++ b/source/adapters/hip/context.hpp @@ -165,45 +165,25 @@ struct ur_context_handle_t_ { }; namespace { -/// RAII type to guarantee recovering original HIP context -/// Scoped context is used across all UR HIP plugin implementation -/// to activate the UR Context on the current thread, matching the -/// HIP driver semantics where the context used for the HIP Driver -/// API is the one active on the thread. -/// The implementation tries to avoid replacing the hipCtx_t if it cans +/// Scoped context is used across all UR HIP plugin implementation to activate +/// the native Context on the current thread. The ScopedContext does not +/// reinstate the previous context as all operations in the hip adapter that +/// require an active context, set the active context and don't rely on context +/// reinstation class ScopedContext { - hipCtx_t Original; - bool NeedToRecover; - public: - ScopedContext(ur_device_handle_t hDevice) : NeedToRecover{false} { + ScopedContext(ur_device_handle_t hDevice) { + hipCtx_t Original{}; if (!hDevice) { throw UR_RESULT_ERROR_INVALID_DEVICE; } - // FIXME when multi device context are supported in HIP adapter hipCtx_t Desired = hDevice->getNativeContext(); UR_CHECK_ERROR(hipCtxGetCurrent(&Original)); if (Original != Desired) { // Sets the desired context as the active one for the thread UR_CHECK_ERROR(hipCtxSetCurrent(Desired)); - if (Original == nullptr) { - // No context is installed on the current thread - // This is the most common case. We can activate the context in the - // thread and leave it there until all the UR context referring to the - // same underlying HIP context are destroyed. This emulates - // the behaviour of the HIP runtime api, and avoids costly context - // switches. No action is required on this side of the if. - } else { - NeedToRecover = true; - } - } - } - - ~ScopedContext() { - if (NeedToRecover) { - UR_CHECK_ERROR(hipCtxSetCurrent(Original)); } } }; From 18d333f52d6da5a4a3df6922ee84d894ba464f6d Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 9 Oct 2023 10:58:25 +0100 Subject: [PATCH 106/145] Revert add prefetch for USM hip allocations a6b8fa66b537753415d24076f1025c040110c332 --- source/adapters/hip/context.hpp | 53 --------------------------------- source/adapters/hip/enqueue.cpp | 11 +------ source/adapters/hip/kernel.cpp | 2 +- source/adapters/hip/kernel.hpp | 15 ---------- 4 files changed, 2 insertions(+), 79 deletions(-) diff --git a/source/adapters/hip/context.hpp b/source/adapters/hip/context.hpp index d3b5fc91d0..d5eb2e1df8 100644 --- a/source/adapters/hip/context.hpp +++ b/source/adapters/hip/context.hpp @@ -10,7 +10,6 @@ #pragma once #include -#include #include "common.hpp" #include "device.hpp" @@ -106,61 +105,9 @@ struct ur_context_handle_t_ { ur_usm_pool_handle_t getOwningURPool(umf_memory_pool_t *UMFPool); - /// We need to keep track of USM mappings in AMD HIP, as certain extra - /// synchronization *is* actually required for correctness. - /// During kernel enqueue we must dispatch a prefetch for each kernel argument - /// that points to a USM mapping to ensure the mapping is correctly - /// populated on the device (https://github.com/intel/llvm/issues/7252). Thus, - /// we keep track of mappings in the context, and then check against them just - /// before the kernel is launched. The stream against which the kernel is - /// launched is not known until enqueue time, but the USM mappings can happen - /// at any time. Thus, they are tracked on the context used for the urUSM* - /// mapping. - /// - /// The three utility function are simple wrappers around a mapping from a - /// pointer to a size. - void addUSMMapping(void *Ptr, size_t Size) { - std::lock_guard Guard(Mutex); - assert(USMMappings.find(Ptr) == USMMappings.end() && - "mapping already exists"); - USMMappings[Ptr] = Size; - } - - void removeUSMMapping(const void *Ptr) { - std::lock_guard guard(Mutex); - auto It = USMMappings.find(Ptr); - if (It != USMMappings.end()) - USMMappings.erase(It); - } - - std::pair getUSMMapping(const void *Ptr) { - std::lock_guard Guard(Mutex); - auto It = USMMappings.find(Ptr); - // The simple case is the fast case... - if (It != USMMappings.end()) - return *It; - - // ... but in the failure case we have to fall back to a full scan to search - // for "offset" pointers in case the user passes in the middle of an - // allocation. We have to do some not-so-ordained-by-the-standard ordered - // comparisons of pointers here, but it'll work on all platforms we support. - uintptr_t PtrVal = (uintptr_t)Ptr; - for (std::pair Pair : USMMappings) { - uintptr_t BaseAddr = (uintptr_t)Pair.first; - uintptr_t EndAddr = BaseAddr + Pair.second; - if (PtrVal > BaseAddr && PtrVal < EndAddr) { - // If we've found something now, offset *must* be nonzero - assert(Pair.second); - return Pair; - } - } - return {nullptr, 0}; - } - private: std::mutex Mutex; std::vector ExtendedDeleters; - std::unordered_map USMMappings; std::set PoolHandles; }; diff --git a/source/adapters/hip/enqueue.cpp b/source/adapters/hip/enqueue.cpp index 95292ad00d..1a73618c77 100644 --- a/source/adapters/hip/enqueue.cpp +++ b/source/adapters/hip/enqueue.cpp @@ -258,7 +258,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( try { ur_device_handle_t Dev = hQueue->getDevice(); ScopedContext Active(Dev); - ur_context_handle_t Ctx = hQueue->getContext(); uint32_t StreamToken; ur_stream_quard Guard; @@ -266,14 +265,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( numEventsInWaitList, phEventWaitList, Guard, &StreamToken); hipFunction_t HIPFunc = hKernel->get(); - hipDevice_t HIPDev = Dev->get(); - for (const void *P : hKernel->getPtrArgs()) { - auto [Addr, Size] = Ctx->getUSMMapping(P); - if (!Addr) - continue; - if (hipMemPrefetchAsync(Addr, Size, HIPDev, HIPStream) != hipSuccess) - return UR_RESULT_ERROR_INVALID_KERNEL_ARGS; - } Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, phEventWaitList); @@ -315,7 +306,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( int DeviceMaxLocalMem = 0; UR_CHECK_ERROR(hipDeviceGetAttribute( &DeviceMaxLocalMem, hipDeviceAttributeMaxSharedMemoryPerBlock, - HIPDev)); + Dev->get())); static const int EnvVal = std::atoi(LocalMemSzPtr); if (EnvVal <= 0 || EnvVal > DeviceMaxLocalMem) { diff --git a/source/adapters/hip/kernel.cpp b/source/adapters/hip/kernel.cpp index 642743ddbf..cc6f4384bc 100644 --- a/source/adapters/hip/kernel.cpp +++ b/source/adapters/hip/kernel.cpp @@ -259,7 +259,7 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgPointer( ur_kernel_handle_t hKernel, uint32_t argIndex, const ur_kernel_arg_pointer_properties_t *, const void *pArgValue) { - hKernel->setKernelPtrArg(argIndex, sizeof(pArgValue), pArgValue); + hKernel->setKernelArg(argIndex, sizeof(pArgValue), pArgValue); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/hip/kernel.hpp b/source/adapters/hip/kernel.hpp index 3db9dce19a..f13478a69c 100644 --- a/source/adapters/hip/kernel.hpp +++ b/source/adapters/hip/kernel.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include "program.hpp" @@ -58,7 +57,6 @@ struct ur_kernel_handle_t_ { args_size_t ParamSizes; args_index_t Indices; args_size_t OffsetPerIndex; - std::set PtrArgs; std::uint32_t ImplicitOffsetArgs[3] = {0, 0, 0}; @@ -179,19 +177,6 @@ struct ur_kernel_handle_t_ { Args.addArg(Index, Size, Arg); } - /// We track all pointer arguments to be able to issue prefetches at enqueue - /// time - void setKernelPtrArg(int Index, size_t Size, const void *PtrArg) { - Args.PtrArgs.insert(*static_cast(PtrArg)); - setKernelArg(Index, Size, PtrArg); - } - - bool isPtrArg(const void *ptr) { - return Args.PtrArgs.find(ptr) != Args.PtrArgs.end(); - } - - std::set &getPtrArgs() { return Args.PtrArgs; } - void setKernelLocalArg(int Index, size_t Size) { Args.addLocalArg(Index, Size); } From 82d4cef9ff03cb6263800686dfada001cff33191 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Wed, 22 Nov 2023 11:16:44 +0800 Subject: [PATCH 107/145] [NATIVECPU] Fix build errors when -Werror=on --- source/adapters/native_cpu/enqueue.cpp | 9 +++++---- source/adapters/native_cpu/kernel.cpp | 7 ++++++- source/adapters/native_cpu/memory.hpp | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/source/adapters/native_cpu/enqueue.cpp b/source/adapters/native_cpu/enqueue.cpp index 24b30b4c67..d9e73c5453 100644 --- a/source/adapters/native_cpu/enqueue.cpp +++ b/source/adapters/native_cpu/enqueue.cpp @@ -144,12 +144,11 @@ static inline ur_result_t enqueueMemBufferReadWriteRect_impl( size_t host_origin = (d + HostOffset.z) * HostSlicePitch + (h + HostOffset.y) * HostRowPitch + w + HostOffset.x; - int8_t &host_mem = ur_cast(DstMem)[host_origin]; int8_t &buff_mem = ur_cast(Buff->_mem)[buff_orign]; - if (IsRead) - host_mem = buff_mem; + if constexpr (IsRead) + ur_cast(DstMem)[host_origin] = buff_mem; else - buff_mem = host_mem; + buff_mem = ur_cast(DstMem)[host_origin]; } return UR_RESULT_SUCCESS; } @@ -160,6 +159,8 @@ static inline ur_result_t doCopy_impl(ur_queue_handle_t hQueue, void *DstPtr, const ur_event_handle_t *EventWaitList, ur_event_handle_t *Event) { // todo: non-blocking, events, UR integration + std::ignore = EventWaitList; + std::ignore = Event; std::ignore = hQueue; std::ignore = numEventsInWaitList; if (SrcPtr != DstPtr && Size) diff --git a/source/adapters/native_cpu/kernel.cpp b/source/adapters/native_cpu/kernel.cpp index 96648e57f8..d1a885203c 100644 --- a/source/adapters/native_cpu/kernel.cpp +++ b/source/adapters/native_cpu/kernel.cpp @@ -25,7 +25,8 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName, if (kernelEntry == hProgram->_kernels.end()) return UR_RESULT_ERROR_INVALID_KERNEL; - auto f = reinterpret_cast(kernelEntry->second); + auto f = reinterpret_cast( + const_cast(kernelEntry->second)); auto kernel = new ur_kernel_handle_t_(pKernelName, *f); *phKernel = kernel; @@ -171,6 +172,10 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, // todo: set proper values return ReturnValue(0); } + case UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32: { + // todo: set proper values + return ReturnValue(0); + } } DIE_NO_IMPLEMENTATION; } diff --git a/source/adapters/native_cpu/memory.hpp b/source/adapters/native_cpu/memory.hpp index 10f443ca0c..45a28ccc67 100644 --- a/source/adapters/native_cpu/memory.hpp +++ b/source/adapters/native_cpu/memory.hpp @@ -61,6 +61,7 @@ struct _ur_buffer final : ur_mem_handle_t_ { : ur_mem_handle_t_(Size, false) {} _ur_buffer(_ur_buffer *b, size_t Offset, size_t Size) : ur_mem_handle_t_(b->_mem + Offset, false), SubBuffer(b) { + std::ignore = Size; SubBuffer.Origin = Offset; } From 9c8e5c4afcbd56137c3a12e60f4fa5f0f2717cbb Mon Sep 17 00:00:00 2001 From: "Zhao, Yang2" Date: Tue, 21 Nov 2023 23:58:42 -0800 Subject: [PATCH 108/145] fix urAdapterGet ignore NumEntries --- source/loader/ur_ldrddi.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 649fc0ad88..9d3a0bc695 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -100,6 +100,9 @@ __urdlllocal ur_result_t UR_APICALL urAdapterGet( break; } adapterIndex++; + if (adapterIndex == NumEntries) { + break; + } } } From b7731bc8680179410fca8d87c4aa24828a3ca942 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Wed, 22 Nov 2023 15:24:32 +0000 Subject: [PATCH 109/145] atomic incr/decr-compare --- source/adapters/native_cpu/common.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/adapters/native_cpu/common.hpp b/source/adapters/native_cpu/common.hpp index 9647fdbf24..d792cbbbcf 100644 --- a/source/adapters/native_cpu/common.hpp +++ b/source/adapters/native_cpu/common.hpp @@ -61,16 +61,16 @@ struct _ur_object { ur_shared_mutex Mutex; }; +// Todo: replace this with a common helper once it is available struct RefCounted { std::atomic_uint32_t _refCount; - void incrementReferenceCount() { _refCount++; } - void decrementReferenceCount() { _refCount--; } + uint32_t incrementReferenceCount() { return ++_refCount; } + uint32_t decrementReferenceCount() { return --_refCount; } RefCounted() : _refCount{1} {} uint32_t getReferenceCount() const { return _refCount; } }; template inline void decrementOrDelete(T *refC) { - refC->decrementReferenceCount(); - if (refC->getReferenceCount() == 0) + if (refC->decrementReferenceCount() == 0) delete refC; } From d0319b23c6ad2045cf33d9eacf183d7879ae8c78 Mon Sep 17 00:00:00 2001 From: Wenju He Date: Thu, 23 Nov 2023 08:04:57 +0800 Subject: [PATCH 110/145] use unreachable for UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32 --- source/adapters/native_cpu/kernel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/adapters/native_cpu/kernel.cpp b/source/adapters/native_cpu/kernel.cpp index d1a885203c..cfe5f0a930 100644 --- a/source/adapters/native_cpu/kernel.cpp +++ b/source/adapters/native_cpu/kernel.cpp @@ -173,8 +173,11 @@ urKernelGetSubGroupInfo(ur_kernel_handle_t hKernel, ur_device_handle_t hDevice, return ReturnValue(0); } case UR_KERNEL_SUB_GROUP_INFO_FORCE_UINT32: { - // todo: set proper values - return ReturnValue(0); +#ifdef _MSC_VER + __assume(0); +#else + __builtin_unreachable(); +#endif } } DIE_NO_IMPLEMENTATION; From eb472b41534af17bc855cf2671a65b4121e72961 Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Thu, 23 Nov 2023 08:56:53 +0100 Subject: [PATCH 111/145] Fix Clang on Windows builds in CI Fixes issue #1111. Enable clang-cl test builds on Windows in the Github Actions workflow. Also: - Remove redundant '.exe' suffixes. - Run Windows builds on the max available number of cpus. --- .github/workflows/cmake.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index fa82331fdb..4a3c4ddfeb 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -98,7 +98,10 @@ jobs: matrix: os: ['windows-2019', 'windows-2022'] build_type: [Debug, Release] - compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}] + compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}] + include: + - compiler: {c: clang-cl, cxx: clang-cl} + toolset: "-T ClangCL" runs-on: ${{matrix.os}} steps: @@ -122,6 +125,7 @@ jobs: run: > cmake -B${{github.workspace}}/build + ${{matrix.toolset}} -DCMAKE_C_COMPILER=${{matrix.compiler.c}} -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}} -DCMAKE_POLICY_DEFAULT_CMP0094=NEW @@ -135,7 +139,7 @@ jobs: run: cmake --build ${{github.workspace}}/build --target check-generated --config ${{matrix.build_type}} - name: Build all - run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j 2 + run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}} -j $Env:NUMBER_OF_PROCESSORS - name: Test working-directory: ${{github.workspace}}/build From 10e20fef46ced4ea377bf56c3e2d48cea1a41372 Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Thu, 23 Nov 2023 15:45:01 +0100 Subject: [PATCH 112/145] Remove ur::print namespace Put all printing operators in the global namespace where all API objects reside. --- include/ur_print.hpp | 3018 +++++++++--------- scripts/templates/print.hpp.mako | 48 +- source/common/logger/ur_sinks.hpp | 1 - test/loader/loader_lifetime/urLoaderInit.cpp | 2 +- test/unit/utils/params.cpp | 3 +- 5 files changed, 1529 insertions(+), 1543 deletions(-) diff --git a/include/ur_print.hpp b/include/ur_print.hpp index f779e95f2b..2a4851e770 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -17,9 +17,7 @@ #include #include -namespace ur { -namespace print { -namespace details { +namespace ur::details { template struct is_handle : std::false_type {}; template <> @@ -204,7 +202,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_ template <> inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_exp_peer_info_t value, size_t size); -} // namespace details +} // namespace ur::details UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_function_t value); UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value); @@ -1025,7 +1023,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_structure_type_t struct inline ur_result_t printStruct(std::ostream &os, const void *ptr) { @@ -1251,7 +1249,7 @@ inline ur_result_t printStruct(std::ostream &os, const void *ptr) { } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_result_t type /// @returns @@ -1497,8 +1495,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_base_propertie os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -1517,8 +1515,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_base_desc_t pa os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -1599,7 +1597,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_init_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_init_flag_t flag template <> @@ -1667,7 +1665,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t f } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_loader_config_info_t type /// @returns @@ -1686,7 +1684,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_loader_config_info_t value) } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_loader_config_info_t enum value template <> @@ -1719,7 +1717,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_loader_conf } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_code_location_t type @@ -1730,14 +1728,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_code_location_ os << ".functionName = "; - details::printPtr(os, - (params.functionName)); + ur::details::printPtr(os, + (params.functionName)); os << ", "; os << ".sourceFile = "; - details::printPtr(os, - (params.sourceFile)); + ur::details::printPtr(os, + (params.sourceFile)); os << ", "; os << ".lineNumber = "; @@ -1770,7 +1768,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_adapter_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_adapter_info_t enum value template <> @@ -1810,7 +1808,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_adapter_inf } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_adapter_backend_t type @@ -1872,7 +1870,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_platform_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_platform_info_t enum value template <> @@ -1925,7 +1923,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_platform_in } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_api_version_t type @@ -1949,8 +1947,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_platform_nativ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -2004,14 +2002,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_device_binary_ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".pDeviceTargetSpec = "; - details::printPtr(os, - (params.pDeviceTargetSpec)); + ur::details::printPtr(os, + (params.pDeviceTargetSpec)); os << "}"; return os; @@ -2457,7 +2455,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_info_t enum value template <> @@ -2561,8 +2559,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -2574,8 +2572,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -2587,8 +2585,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -2600,8 +2598,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3189,8 +3187,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3202,8 +3200,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3215,8 +3213,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3233,8 +3231,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -3322,8 +3320,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -3361,8 +3359,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3426,8 +3424,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3439,8 +3437,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3452,8 +3450,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3465,8 +3463,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3478,8 +3476,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3621,8 +3619,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3634,8 +3632,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3647,8 +3645,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -3660,8 +3658,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -4009,7 +4007,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_device_info } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_affinity_domain_flag_t type @@ -4042,7 +4040,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_affinity_domain_flag return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_affinity_domain_flag_t flag template <> @@ -4120,7 +4118,7 @@ inline ur_result_t printFlag(std::ostream &os, } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_partition_t type /// @returns @@ -4145,7 +4143,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_partition_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// // @brief Print ur_device_partition_value_t union @@ -4174,8 +4172,8 @@ inline ur_result_t printUnion( os << ".affinity_domain = "; - details::printFlag(os, - (params.affinity_domain)); + ur::details::printFlag(os, + (params.affinity_domain)); break; default: @@ -4185,7 +4183,7 @@ inline ur_result_t printUnion( os << "}"; return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_partition_property_t type /// @returns @@ -4199,7 +4197,7 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_device_partiti os << ", "; os << ".value = "; - details::printUnion(os, (params.value), params.type); + ur::details::printUnion(os, (params.value), params.type); os << "}"; return os; @@ -4218,14 +4216,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_device_partiti os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - (params.pProperties)); + ur::details::printPtr(os, + (params.pProperties)); os << ", "; os << ".PropCount = "; @@ -4272,7 +4270,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_fp_capability_flag_t return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_fp_capability_flag_t flag template <> @@ -4370,7 +4368,7 @@ inline ur_result_t printFlag(std::ostream &os, u } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_mem_cache_type_t type /// @returns @@ -4432,7 +4430,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_exec_capability_flag return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_exec_capability_flag_t flag template <> @@ -4470,7 +4468,7 @@ inline ur_result_t printFlag(std::ostream &os, } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_native_properties_t type /// @returns @@ -4485,8 +4483,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_device_native_ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -4524,7 +4522,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_memory_order_capability_fla return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_memory_order_capability_flag_t flag template <> @@ -4592,7 +4590,7 @@ inline ur_result_t printFlag(std::ostream &os } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_memory_scope_capability_flag_t type /// @returns @@ -4621,7 +4619,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_memory_scope_capability_fla return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_memory_scope_capability_flag_t flag template <> @@ -4689,7 +4687,7 @@ inline ur_result_t printFlag(std::ostream &os } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_device_usm_access_capability_flag_t type /// @returns @@ -4715,7 +4713,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_device_usm_access_capabilit return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_device_usm_access_capability_flag_t flag template <> @@ -4773,7 +4771,7 @@ inline ur_result_t printFlag(std::ostrea } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_context_flag_t type /// @returns @@ -4790,7 +4788,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_context_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_context_flag_t flag template <> @@ -4818,7 +4816,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag) } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_context_properties_t type /// @returns @@ -4833,14 +4831,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_context_proper os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - details::printFlag(os, - (params.flags)); + ur::details::printFlag(os, + (params.flags)); os << "}"; return os; @@ -4884,7 +4882,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_context_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_context_info_t enum value template <> @@ -4916,8 +4914,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf os << ", "; } - details::printPtr(os, - tptr[i]); + ur::details::printPtr(os, + tptr[i]); } os << "}"; } break; @@ -4965,8 +4963,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -4978,8 +4976,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -4991,8 +4989,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -5004,8 +5002,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -5015,7 +5013,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_context_inf } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_context_native_properties_t type @@ -5031,8 +5029,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_context_native os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5073,7 +5071,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_mem_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_mem_flag_t flag template <> @@ -5151,7 +5149,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_mem_type_t type /// @returns @@ -5203,7 +5201,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_mem_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_mem_info_t enum value template <> @@ -5233,8 +5231,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_mem_info_t } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -5244,7 +5242,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_mem_info_t } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_image_channel_order_t type @@ -5393,7 +5391,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_image_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_image_info_t enum value template <> @@ -5493,7 +5491,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_image_info_ } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_image_format_t type @@ -5528,8 +5526,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_image_desc_t p os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".type = "; @@ -5593,14 +5591,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_propert os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".pHost = "; - details::printPtr(os, - (params.pHost)); + ur::details::printPtr(os, + (params.pHost)); os << "}"; return os; @@ -5619,8 +5617,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_channel os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".channel = "; @@ -5644,8 +5642,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_alloc_l os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".location = "; @@ -5669,8 +5667,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_buffer_region_ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".origin = "; @@ -5714,8 +5712,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_mem_native_pro os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5797,7 +5795,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_sampler_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_sampler_info_t enum value template <> @@ -5827,8 +5825,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_sampler_inf } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -5874,7 +5872,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_sampler_inf } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_sampler_desc_t type @@ -5890,8 +5888,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_sampler_desc_t os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".normalizedCoords = "; @@ -5925,8 +5923,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_sampler_native os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -5952,7 +5950,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_host_mem_flag_t value) return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_host_mem_flag_t flag template <> @@ -5980,7 +5978,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_device_mem_flag_t type /// @returns @@ -6003,7 +6001,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_device_mem_flag_t value return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_device_mem_flag_t flag template <> @@ -6051,7 +6049,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_ } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_pool_flag_t type /// @returns @@ -6068,7 +6066,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_pool_flag_t flag template <> @@ -6096,7 +6094,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_type_t type /// @returns @@ -6148,7 +6146,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_alloc_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_alloc_info_t enum value template <> @@ -6202,8 +6200,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_alloc_i } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -6215,8 +6213,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_alloc_i } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -6226,7 +6224,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_alloc_i } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_advice_flag_t type @@ -6286,7 +6284,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_advice_flag_t flag template <> @@ -6454,7 +6452,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t fl } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_desc_t type /// @returns @@ -6469,14 +6467,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_desc_t par os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".hints = "; - details::printFlag(os, - (params.hints)); + ur::details::printFlag(os, + (params.hints)); os << ", "; os << ".align = "; @@ -6500,14 +6498,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_host_desc_ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - details::printFlag(os, - (params.flags)); + ur::details::printFlag(os, + (params.flags)); os << "}"; return os; @@ -6526,14 +6524,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_device_des os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - details::printFlag(os, - (params.flags)); + ur::details::printFlag(os, + (params.flags)); os << "}"; return os; @@ -6552,14 +6550,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_pool_desc_ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - details::printFlag(os, - (params.flags)); + ur::details::printFlag(os, + (params.flags)); os << "}"; return os; @@ -6578,8 +6576,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_usm_pool_limit os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".maxPoolableSize = "; @@ -6612,7 +6610,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_pool_info_t enum value template <> @@ -6642,8 +6640,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_pool_in } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -6653,7 +6651,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_usm_pool_in } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_virtual_mem_granularity_info_t type @@ -6673,7 +6671,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_granularity_inf } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_virtual_mem_granularity_info_t enum value template <> @@ -6713,7 +6711,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_virtual_mem_access_flag_t type @@ -6737,7 +6735,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_access_flag_t v return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_virtual_mem_access_flag_t flag template <> @@ -6785,7 +6783,7 @@ inline ur_result_t printFlag(std::ostream &os, uin } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_virtual_mem_info_t type /// @returns @@ -6801,7 +6799,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_virtual_mem_info_t enum value template <> @@ -6819,8 +6817,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -6830,7 +6828,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_virtual_mem } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_physical_mem_flag_t type @@ -6848,7 +6846,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_physical_mem_flag_t value) return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_physical_mem_flag_t flag template <> @@ -6876,7 +6874,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_physical_mem_properties_t type /// @returns @@ -6891,14 +6889,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_physical_mem_p os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - details::printFlag(os, - (params.flags)); + ur::details::printFlag(os, + (params.flags)); os << "}"; return os; @@ -6927,7 +6925,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_program_metadata_type_t val } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// // @brief Print ur_program_metadata_value_t union @@ -6956,16 +6954,16 @@ inline ur_result_t printUnion( os << ".pString = "; - details::printPtr(os, - (params.pString)); + ur::details::printPtr(os, + (params.pString)); break; case UR_PROGRAM_METADATA_TYPE_BYTE_ARRAY: os << ".pData = "; - details::printPtr(os, - (params.pData)); + ur::details::printPtr(os, + (params.pData)); break; default: @@ -6975,7 +6973,7 @@ inline ur_result_t printUnion( os << "}"; return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_program_metadata_t type /// @returns @@ -6985,8 +6983,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_program_metada os << ".pName = "; - details::printPtr(os, - (params.pName)); + ur::details::printPtr(os, + (params.pName)); os << ", "; os << ".type = "; @@ -7000,7 +6998,7 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_program_metada os << ", "; os << ".value = "; - details::printUnion(os, (params.value), params.type); + ur::details::printUnion(os, (params.value), params.type); os << "}"; return os; @@ -7019,8 +7017,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_program_proper os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".count = "; @@ -7080,7 +7078,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_program_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_program_info_t enum value template <> @@ -7110,8 +7108,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_inf } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -7137,8 +7135,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_inf os << ", "; } - details::printPtr(os, - tptr[i]); + ur::details::printPtr(os, + tptr[i]); } os << "}"; } break; @@ -7189,7 +7187,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_inf } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_program_build_status_t type @@ -7263,7 +7261,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_program_build_info_t value) } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_program_build_info_t enum value template <> @@ -7313,7 +7311,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_program_bui } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_specialization_constant_info_t type @@ -7334,8 +7332,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_specialization os << ", "; os << ".pValue = "; - details::printPtr(os, - (params.pValue)); + ur::details::printPtr(os, + (params.pValue)); os << "}"; return os; @@ -7354,8 +7352,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_program_native os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -7379,8 +7377,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_val os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -7399,8 +7397,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_loc os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -7438,7 +7436,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_kernel_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_kernel_info_t enum value template <> @@ -7485,8 +7483,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_info } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -7498,8 +7496,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_info } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -7526,7 +7524,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_info } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_kernel_group_info_t type @@ -7558,7 +7556,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_kernel_group_info_t value) } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_kernel_group_info_t enum value template <> @@ -7650,7 +7648,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_grou } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_kernel_sub_group_info_t type @@ -7676,7 +7674,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_kernel_sub_group_info_t val } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_kernel_sub_group_info_t enum value template <> @@ -7740,7 +7738,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_sub_ } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_kernel_cache_config_t type @@ -7784,7 +7782,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_kernel_exec_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_kernel_exec_info_t enum value template <> @@ -7838,7 +7836,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_kernel_exec } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_kernel_arg_pointer_properties_t type @@ -7854,8 +7852,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_poi os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -7874,8 +7872,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_exec_in os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -7894,8 +7892,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_sam os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -7914,14 +7912,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_arg_mem os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".memoryAccess = "; - details::printFlag(os, - (params.memoryAccess)); + ur::details::printFlag(os, + (params.memoryAccess)); os << "}"; return os; @@ -7940,8 +7938,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_kernel_native_ os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -7984,7 +7982,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_queue_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_queue_info_t enum value template <> @@ -8002,8 +8000,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_ } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -8015,8 +8013,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_ } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -8028,8 +8026,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_ } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -8041,8 +8039,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_ } os << (const void *)(tptr) << " ("; - details::printFlag(os, - *tptr); + ur::details::printFlag(os, + *tptr); os << ")"; } break; @@ -8088,7 +8086,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_queue_info_ } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_queue_flag_t type @@ -8136,7 +8134,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_queue_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_queue_flag_t flag template <> @@ -8264,7 +8262,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_queue_properties_t type /// @returns @@ -8279,14 +8277,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_properti os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".flags = "; - details::printFlag(os, - (params.flags)); + ur::details::printFlag(os, + (params.flags)); os << "}"; return os; @@ -8305,8 +8303,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_index_pr os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".computeIndex = "; @@ -8330,14 +8328,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_native_d os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".pNativeData = "; - details::printPtr(os, - (params.pNativeData)); + ur::details::printPtr(os, + (params.pNativeData)); os << "}"; return os; @@ -8356,8 +8354,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_queue_native_p os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8514,7 +8512,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_event_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_event_info_t enum value template <> @@ -8532,8 +8530,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_event_info_ } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -8545,8 +8543,8 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_event_info_ } os << (const void *)(tptr) << " ("; - details::printPtr(os, - *tptr); + ur::details::printPtr(os, + *tptr); os << ")"; } break; @@ -8592,7 +8590,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_event_info_ } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_profiling_info_t type @@ -8621,7 +8619,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_profiling_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_profiling_info_t enum value template <> @@ -8697,7 +8695,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_profiling_i } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_event_native_properties_t type @@ -8713,8 +8711,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_event_native_p os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".isNativeHandleOwned = "; @@ -8770,7 +8768,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_map_flag_t value) { return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_map_flag_t flag template <> @@ -8818,7 +8816,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t flag) { } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_usm_migration_flag_t type /// @returns @@ -8835,7 +8833,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_migration_flag_t value) return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_usm_migration_flag_t flag template <> @@ -8863,7 +8861,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_exp_image_copy_flag_t type /// @returns @@ -8886,7 +8884,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_exp_image_copy_flag_t value return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_exp_image_copy_flag_t flag template <> @@ -8934,7 +8932,7 @@ inline ur_result_t printFlag(std::ostream &os, uint32_ } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_exp_file_descriptor_t type /// @returns @@ -8949,8 +8947,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_file_descr os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".fd = "; @@ -8974,14 +8972,14 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_win32_hand os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".handle = "; - details::printPtr(os, - (params.handle)); + ur::details::printPtr(os, + (params.handle)); os << "}"; return os; @@ -9000,8 +8998,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_sampler_mi os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".minMipmapLevelClamp = "; @@ -9040,8 +9038,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_sampler_ad os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".addrModes = {"; @@ -9071,8 +9069,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_me os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -9091,8 +9089,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_interop_se os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -9111,8 +9109,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_layered_im os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << ", "; os << ".numLayers = "; @@ -9136,8 +9134,8 @@ inline std::ostream &operator<<(std::ostream &os, const struct ur_exp_command_bu os << ", "; os << ".pNext = "; - details::printStruct(os, - (params.pNext)); + ur::details::printStruct(os, + (params.pNext)); os << "}"; return os; @@ -9160,7 +9158,7 @@ inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value) { } return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ur_exp_peer_info_t enum value template <> @@ -9200,7 +9198,7 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_exp_peer_in } return UR_RESULT_SUCCESS; } -} // namespace details +} // namespace ur::details /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_loader_config_create_params_t type @@ -9210,8 +9208,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".phLoaderConfig = "; - details::printPtr(os, - *(params->pphLoaderConfig)); + ur::details::printPtr(os, + *(params->pphLoaderConfig)); return os; } @@ -9224,8 +9222,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hLoaderConfig = "; - details::printPtr(os, - *(params->phLoaderConfig)); + ur::details::printPtr(os, + *(params->phLoaderConfig)); return os; } @@ -9238,8 +9236,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hLoaderConfig = "; - details::printPtr(os, - *(params->phLoaderConfig)); + ur::details::printPtr(os, + *(params->phLoaderConfig)); return os; } @@ -9252,8 +9250,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hLoaderConfig = "; - details::printPtr(os, - *(params->phLoaderConfig)); + ur::details::printPtr(os, + *(params->phLoaderConfig)); os << ", "; os << ".propName = "; @@ -9267,13 +9265,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -9286,14 +9284,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hLoaderConfig = "; - details::printPtr(os, - *(params->phLoaderConfig)); + ur::details::printPtr(os, + *(params->phLoaderConfig)); os << ", "; os << ".pLayerName = "; - details::printPtr(os, - *(params->ppLayerName)); + ur::details::printPtr(os, + *(params->ppLayerName)); return os; } @@ -9306,8 +9304,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hLoaderConfig = "; - details::printPtr(os, - *(params->phLoaderConfig)); + ur::details::printPtr(os, + *(params->phLoaderConfig)); os << ", "; os << ".pfnCodeloc = "; @@ -9318,8 +9316,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pUserData = "; - details::printPtr(os, - *(params->ppUserData)); + ur::details::printPtr(os, + *(params->ppUserData)); return os; } @@ -9336,8 +9334,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphAdapters))[i]); + ur::details::printPtr(os, + (*(params->pphAdapters))[i]); } os << "}"; @@ -9358,16 +9356,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphPlatforms))[i]); + ur::details::printPtr(os, + (*(params->pphPlatforms))[i]); } os << "}"; os << ", "; os << ".pNumPlatforms = "; - details::printPtr(os, - *(params->ppNumPlatforms)); + ur::details::printPtr(os, + *(params->ppNumPlatforms)); return os; } @@ -9380,8 +9378,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPlatform = "; - details::printPtr(os, - *(params->phPlatform)); + ur::details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".propName = "; @@ -9395,13 +9393,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -9414,14 +9412,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPlatform = "; - details::printPtr(os, - *(params->phPlatform)); + ur::details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".phNativePlatform = "; - details::printPtr(os, - *(params->pphNativePlatform)); + ur::details::printPtr(os, + *(params->pphNativePlatform)); return os; } @@ -9434,20 +9432,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativePlatform = "; - details::printPtr(os, - *(params->phNativePlatform)); + ur::details::printPtr(os, + *(params->phNativePlatform)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phPlatform = "; - details::printPtr(os, - *(params->pphPlatform)); + ur::details::printPtr(os, + *(params->pphPlatform)); return os; } @@ -9460,14 +9458,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPlatform = "; - details::printPtr(os, - *(params->phPlatform)); + ur::details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".pVersion = "; - details::printPtr(os, - *(params->ppVersion)); + ur::details::printPtr(os, + *(params->ppVersion)); return os; } @@ -9480,20 +9478,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPlatform = "; - details::printPtr(os, - *(params->phPlatform)); + ur::details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".pFrontendOption = "; - details::printPtr(os, - *(params->ppFrontendOption)); + ur::details::printPtr(os, + *(params->ppFrontendOption)); os << ", "; os << ".ppPlatformOption = "; - details::printPtr(os, - *(params->pppPlatformOption)); + ur::details::printPtr(os, + *(params->pppPlatformOption)); return os; } @@ -9515,22 +9513,22 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphDevices))[i]); + ur::details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phContext = "; - details::printPtr(os, - *(params->pphContext)); + ur::details::printPtr(os, + *(params->pphContext)); return os; } @@ -9543,8 +9541,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); return os; } @@ -9557,8 +9555,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); return os; } @@ -9571,8 +9569,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".propName = "; @@ -9586,13 +9584,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -9605,14 +9603,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".phNativeContext = "; - details::printPtr(os, - *(params->pphNativeContext)); + ur::details::printPtr(os, + *(params->pphNativeContext)); return os; } @@ -9625,8 +9623,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeContext = "; - details::printPtr(os, - *(params->phNativeContext)); + ur::details::printPtr(os, + *(params->phNativeContext)); os << ", "; os << ".numDevices = "; @@ -9640,22 +9638,22 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphDevices))[i]); + ur::details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phContext = "; - details::printPtr(os, - *(params->pphContext)); + ur::details::printPtr(os, + *(params->pphContext)); return os; } @@ -9668,8 +9666,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pfnDeleter = "; @@ -9680,8 +9678,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pUserData = "; - details::printPtr(os, - *(params->ppUserData)); + ur::details::printPtr(os, + *(params->ppUserData)); return os; } @@ -9694,8 +9692,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hEvent = "; - details::printPtr(os, - *(params->phEvent)); + ur::details::printPtr(os, + *(params->phEvent)); os << ", "; os << ".propName = "; @@ -9709,13 +9707,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -9728,8 +9726,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hEvent = "; - details::printPtr(os, - *(params->phEvent)); + ur::details::printPtr(os, + *(params->phEvent)); os << ", "; os << ".propName = "; @@ -9743,13 +9741,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -9771,8 +9769,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; @@ -9787,8 +9785,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hEvent = "; - details::printPtr(os, - *(params->phEvent)); + ur::details::printPtr(os, + *(params->phEvent)); return os; } @@ -9801,8 +9799,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hEvent = "; - details::printPtr(os, - *(params->phEvent)); + ur::details::printPtr(os, + *(params->phEvent)); return os; } @@ -9815,14 +9813,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hEvent = "; - details::printPtr(os, - *(params->phEvent)); + ur::details::printPtr(os, + *(params->phEvent)); os << ", "; os << ".phNativeEvent = "; - details::printPtr(os, - *(params->pphNativeEvent)); + ur::details::printPtr(os, + *(params->pphNativeEvent)); return os; } @@ -9835,26 +9833,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeEvent = "; - details::printPtr(os, - *(params->phNativeEvent)); + ur::details::printPtr(os, + *(params->phNativeEvent)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -9867,8 +9865,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hEvent = "; - details::printPtr(os, - *(params->phEvent)); + ur::details::printPtr(os, + *(params->phEvent)); os << ", "; os << ".execStatus = "; @@ -9884,8 +9882,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pUserData = "; - details::printPtr(os, - *(params->ppUserData)); + ur::details::printPtr(os, + *(params->ppUserData)); return os; } @@ -9898,14 +9896,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pIL = "; - details::printPtr(os, - *(params->ppIL)); + ur::details::printPtr(os, + *(params->ppIL)); os << ", "; os << ".length = "; @@ -9915,14 +9913,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phProgram = "; - details::printPtr(os, - *(params->pphProgram)); + ur::details::printPtr(os, + *(params->pphProgram)); return os; } @@ -9935,14 +9933,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".size = "; @@ -9952,20 +9950,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pBinary = "; - details::printPtr(os, - *(params->ppBinary)); + ur::details::printPtr(os, + *(params->ppBinary)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phProgram = "; - details::printPtr(os, - *(params->pphProgram)); + ur::details::printPtr(os, + *(params->pphProgram)); return os; } @@ -9978,20 +9976,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pOptions = "; - details::printPtr(os, - *(params->ppOptions)); + ur::details::printPtr(os, + *(params->ppOptions)); return os; } @@ -10004,8 +10002,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".numDevices = "; @@ -10019,16 +10017,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphDevices))[i]); + ur::details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pOptions = "; - details::printPtr(os, - *(params->ppOptions)); + ur::details::printPtr(os, + *(params->ppOptions)); return os; } @@ -10041,20 +10039,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pOptions = "; - details::printPtr(os, - *(params->ppOptions)); + ur::details::printPtr(os, + *(params->ppOptions)); return os; } @@ -10067,8 +10065,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".numDevices = "; @@ -10082,16 +10080,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphDevices))[i]); + ur::details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pOptions = "; - details::printPtr(os, - *(params->ppOptions)); + ur::details::printPtr(os, + *(params->ppOptions)); return os; } @@ -10104,8 +10102,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".count = "; @@ -10119,22 +10117,22 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphPrograms))[i]); + ur::details::printPtr(os, + (*(params->pphPrograms))[i]); } os << "}"; os << ", "; os << ".pOptions = "; - details::printPtr(os, - *(params->ppOptions)); + ur::details::printPtr(os, + *(params->ppOptions)); os << ", "; os << ".phProgram = "; - details::printPtr(os, - *(params->pphProgram)); + ur::details::printPtr(os, + *(params->pphProgram)); return os; } @@ -10147,8 +10145,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".numDevices = "; @@ -10162,8 +10160,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphDevices))[i]); + ur::details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; @@ -10179,22 +10177,22 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphPrograms))[i]); + ur::details::printPtr(os, + (*(params->pphPrograms))[i]); } os << "}"; os << ", "; os << ".pOptions = "; - details::printPtr(os, - *(params->ppOptions)); + ur::details::printPtr(os, + *(params->ppOptions)); os << ", "; os << ".phProgram = "; - details::printPtr(os, - *(params->pphProgram)); + ur::details::printPtr(os, + *(params->pphProgram)); return os; } @@ -10207,8 +10205,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); return os; } @@ -10221,8 +10219,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); return os; } @@ -10235,26 +10233,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pFunctionName = "; - details::printPtr(os, - *(params->ppFunctionName)); + ur::details::printPtr(os, + *(params->ppFunctionName)); os << ", "; os << ".ppFunctionPointer = "; - details::printPtr(os, - *(params->pppFunctionPointer)); + ur::details::printPtr(os, + *(params->pppFunctionPointer)); return os; } @@ -10267,8 +10265,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".propName = "; @@ -10282,13 +10280,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -10301,14 +10299,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -10322,13 +10320,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -10341,8 +10339,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".count = "; @@ -10371,14 +10369,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".phNativeProgram = "; - details::printPtr(os, - *(params->pphNativeProgram)); + ur::details::printPtr(os, + *(params->pphNativeProgram)); return os; } @@ -10391,26 +10389,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeProgram = "; - details::printPtr(os, - *(params->phNativeProgram)); + ur::details::printPtr(os, + *(params->phNativeProgram)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phProgram = "; - details::printPtr(os, - *(params->pphProgram)); + ur::details::printPtr(os, + *(params->pphProgram)); return os; } @@ -10423,20 +10421,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pKernelName = "; - details::printPtr(os, - *(params->ppKernelName)); + ur::details::printPtr(os, + *(params->ppKernelName)); os << ", "; os << ".phKernel = "; - details::printPtr(os, - *(params->pphKernel)); + ur::details::printPtr(os, + *(params->pphKernel)); return os; } @@ -10449,8 +10447,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".propName = "; @@ -10464,13 +10462,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -10483,14 +10481,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -10504,13 +10502,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -10523,14 +10521,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -10544,13 +10542,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -10563,8 +10561,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); return os; } @@ -10577,8 +10575,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); return os; } @@ -10591,14 +10589,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".phNativeKernel = "; - details::printPtr(os, - *(params->pphNativeKernel)); + ur::details::printPtr(os, + *(params->pphNativeKernel)); return os; } @@ -10611,32 +10609,32 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeKernel = "; - details::printPtr(os, - *(params->phNativeKernel)); + ur::details::printPtr(os, + *(params->phNativeKernel)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phKernel = "; - details::printPtr(os, - *(params->pphKernel)); + ur::details::printPtr(os, + *(params->pphKernel)); return os; } @@ -10649,8 +10647,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -10665,14 +10663,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".pArgValue = "; - details::printPtr(os, - *(params->ppArgValue)); + ur::details::printPtr(os, + *(params->ppArgValue)); return os; } @@ -10685,8 +10683,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -10701,8 +10699,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); return os; } @@ -10715,8 +10713,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -10726,14 +10724,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".pArgValue = "; - details::printPtr(os, - *(params->ppArgValue)); + ur::details::printPtr(os, + *(params->ppArgValue)); return os; } @@ -10746,8 +10744,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".propName = "; @@ -10762,12 +10760,12 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); return os; } @@ -10780,8 +10778,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -10791,14 +10789,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".hArgValue = "; - details::printPtr(os, - *(params->phArgValue)); + ur::details::printPtr(os, + *(params->phArgValue)); return os; } @@ -10811,8 +10809,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".argIndex = "; @@ -10822,14 +10820,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".hArgValue = "; - details::printPtr(os, - *(params->phArgValue)); + ur::details::printPtr(os, + *(params->phArgValue)); return os; } @@ -10842,8 +10840,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".count = "; @@ -10853,8 +10851,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSpecConstants = "; - details::printPtr(os, - *(params->ppSpecConstants)); + ur::details::printPtr(os, + *(params->ppSpecConstants)); return os; } @@ -10867,14 +10865,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".pGroupCountRet = "; - details::printPtr(os, - *(params->ppGroupCountRet)); + ur::details::printPtr(os, + *(params->ppGroupCountRet)); return os; } @@ -10887,20 +10885,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pDesc = "; - details::printPtr(os, - *(params->ppDesc)); + ur::details::printPtr(os, + *(params->ppDesc)); os << ", "; os << ".phSampler = "; - details::printPtr(os, - *(params->pphSampler)); + ur::details::printPtr(os, + *(params->pphSampler)); return os; } @@ -10913,8 +10911,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hSampler = "; - details::printPtr(os, - *(params->phSampler)); + ur::details::printPtr(os, + *(params->phSampler)); return os; } @@ -10927,8 +10925,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hSampler = "; - details::printPtr(os, - *(params->phSampler)); + ur::details::printPtr(os, + *(params->phSampler)); return os; } @@ -10941,8 +10939,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hSampler = "; - details::printPtr(os, - *(params->phSampler)); + ur::details::printPtr(os, + *(params->phSampler)); os << ", "; os << ".propName = "; @@ -10956,13 +10954,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -10975,14 +10973,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hSampler = "; - details::printPtr(os, - *(params->phSampler)); + ur::details::printPtr(os, + *(params->phSampler)); os << ", "; os << ".phNativeSampler = "; - details::printPtr(os, - *(params->pphNativeSampler)); + ur::details::printPtr(os, + *(params->pphNativeSampler)); return os; } @@ -10995,26 +10993,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeSampler = "; - details::printPtr(os, - *(params->phNativeSampler)); + ur::details::printPtr(os, + *(params->phNativeSampler)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phSampler = "; - details::printPtr(os, - *(params->pphSampler)); + ur::details::printPtr(os, + *(params->pphSampler)); return os; } @@ -11027,38 +11025,38 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".pHost = "; - details::printPtr(os, - *(params->ppHost)); + ur::details::printPtr(os, + *(params->ppHost)); os << ", "; os << ".phMem = "; - details::printPtr(os, - *(params->pphMem)); + ur::details::printPtr(os, + *(params->pphMem)); return os; } @@ -11071,14 +11069,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); os << ", "; os << ".size = "; @@ -11088,14 +11086,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phBuffer = "; - details::printPtr(os, - *(params->pphBuffer)); + ur::details::printPtr(os, + *(params->pphBuffer)); return os; } @@ -11108,8 +11106,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hMem = "; - details::printPtr(os, - *(params->phMem)); + ur::details::printPtr(os, + *(params->phMem)); return os; } @@ -11122,8 +11120,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hMem = "; - details::printPtr(os, - *(params->phMem)); + ur::details::printPtr(os, + *(params->phMem)); return os; } @@ -11136,14 +11134,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); os << ", "; os << ".bufferCreateType = "; @@ -11153,14 +11151,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pRegion = "; - details::printPtr(os, - *(params->ppRegion)); + ur::details::printPtr(os, + *(params->ppRegion)); os << ", "; os << ".phMem = "; - details::printPtr(os, - *(params->pphMem)); + ur::details::printPtr(os, + *(params->pphMem)); return os; } @@ -11173,14 +11171,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hMem = "; - details::printPtr(os, - *(params->phMem)); + ur::details::printPtr(os, + *(params->phMem)); os << ", "; os << ".phNativeMem = "; - details::printPtr(os, - *(params->pphNativeMem)); + ur::details::printPtr(os, + *(params->pphNativeMem)); return os; } @@ -11193,26 +11191,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeMem = "; - details::printPtr(os, - *(params->phNativeMem)); + ur::details::printPtr(os, + *(params->phNativeMem)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phMem = "; - details::printPtr(os, - *(params->pphMem)); + ur::details::printPtr(os, + *(params->pphMem)); return os; } @@ -11225,38 +11223,38 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeMem = "; - details::printPtr(os, - *(params->phNativeMem)); + ur::details::printPtr(os, + *(params->phNativeMem)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phMem = "; - details::printPtr(os, - *(params->pphMem)); + ur::details::printPtr(os, + *(params->pphMem)); return os; } @@ -11269,8 +11267,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hMemory = "; - details::printPtr(os, - *(params->phMemory)); + ur::details::printPtr(os, + *(params->phMemory)); os << ", "; os << ".propName = "; @@ -11284,13 +11282,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -11303,8 +11301,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hMemory = "; - details::printPtr(os, - *(params->phMemory)); + ur::details::printPtr(os, + *(params->phMemory)); os << ", "; os << ".propName = "; @@ -11318,13 +11316,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -11337,14 +11335,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".size = "; @@ -11354,14 +11352,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phPhysicalMem = "; - details::printPtr(os, - *(params->pphPhysicalMem)); + ur::details::printPtr(os, + *(params->pphPhysicalMem)); return os; } @@ -11374,8 +11372,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPhysicalMem = "; - details::printPtr(os, - *(params->phPhysicalMem)); + ur::details::printPtr(os, + *(params->phPhysicalMem)); return os; } @@ -11388,8 +11386,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPhysicalMem = "; - details::printPtr(os, - *(params->phPhysicalMem)); + ur::details::printPtr(os, + *(params->phPhysicalMem)); return os; } @@ -11411,16 +11409,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphAdapters))[i]); + ur::details::printPtr(os, + (*(params->pphAdapters))[i]); } os << "}"; os << ", "; os << ".pNumAdapters = "; - details::printPtr(os, - *(params->ppNumAdapters)); + ur::details::printPtr(os, + *(params->ppNumAdapters)); return os; } @@ -11433,8 +11431,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hAdapter = "; - details::printPtr(os, - *(params->phAdapter)); + ur::details::printPtr(os, + *(params->phAdapter)); return os; } @@ -11447,8 +11445,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hAdapter = "; - details::printPtr(os, - *(params->phAdapter)); + ur::details::printPtr(os, + *(params->phAdapter)); return os; } @@ -11461,20 +11459,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hAdapter = "; - details::printPtr(os, - *(params->phAdapter)); + ur::details::printPtr(os, + *(params->phAdapter)); os << ", "; os << ".ppMessage = "; - details::printPtr(os, - *(params->pppMessage)); + ur::details::printPtr(os, + *(params->pppMessage)); os << ", "; os << ".pError = "; - details::printPtr(os, - *(params->ppError)); + ur::details::printPtr(os, + *(params->ppError)); return os; } @@ -11487,8 +11485,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hAdapter = "; - details::printPtr(os, - *(params->phAdapter)); + ur::details::printPtr(os, + *(params->phAdapter)); os << ", "; os << ".propName = "; @@ -11502,13 +11500,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -11521,14 +11519,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -11538,20 +11536,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - details::printPtr(os, - *(params->ppGlobalWorkOffset)); + ur::details::printPtr(os, + *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - details::printPtr(os, - *(params->ppGlobalWorkSize)); + ur::details::printPtr(os, + *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - details::printPtr(os, - *(params->ppLocalWorkSize)); + ur::details::printPtr(os, + *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -11565,16 +11563,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11587,8 +11585,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11602,16 +11600,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11624,8 +11622,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -11639,16 +11637,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11661,14 +11659,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingRead = "; @@ -11688,8 +11686,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11703,16 +11701,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11725,14 +11723,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -11752,8 +11750,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -11767,16 +11765,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11789,14 +11787,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingRead = "; @@ -11841,8 +11839,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -11856,16 +11854,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11878,14 +11876,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingWrite = "; @@ -11930,8 +11928,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -11945,16 +11943,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -11967,20 +11965,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - details::printPtr(os, - *(params->phBufferSrc)); + ur::details::printPtr(os, + *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - details::printPtr(os, - *(params->phBufferDst)); + ur::details::printPtr(os, + *(params->phBufferDst)); os << ", "; os << ".srcOffset = "; @@ -12009,16 +12007,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12031,20 +12029,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBufferSrc = "; - details::printPtr(os, - *(params->phBufferSrc)); + ur::details::printPtr(os, + *(params->phBufferSrc)); os << ", "; os << ".hBufferDst = "; - details::printPtr(os, - *(params->phBufferDst)); + ur::details::printPtr(os, + *(params->phBufferDst)); os << ", "; os << ".srcOrigin = "; @@ -12093,16 +12091,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12115,20 +12113,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".pPattern = "; - details::printPtr(os, - *(params->ppPattern)); + ur::details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -12157,16 +12155,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12179,14 +12177,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hImage = "; - details::printPtr(os, - *(params->phImage)); + ur::details::printPtr(os, + *(params->phImage)); os << ", "; os << ".blockingRead = "; @@ -12216,8 +12214,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -12231,16 +12229,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12253,14 +12251,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hImage = "; - details::printPtr(os, - *(params->phImage)); + ur::details::printPtr(os, + *(params->phImage)); os << ", "; os << ".blockingWrite = "; @@ -12290,8 +12288,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12305,16 +12303,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12327,20 +12325,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hImageSrc = "; - details::printPtr(os, - *(params->phImageSrc)); + ur::details::printPtr(os, + *(params->phImageSrc)); os << ", "; os << ".hImageDst = "; - details::printPtr(os, - *(params->phImageDst)); + ur::details::printPtr(os, + *(params->phImageDst)); os << ", "; os << ".srcOrigin = "; @@ -12369,16 +12367,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12391,14 +12389,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".blockingMap = "; @@ -12408,8 +12406,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".mapFlags = "; - details::printFlag(os, - *(params->pmapFlags)); + ur::details::printFlag(os, + *(params->pmapFlags)); os << ", "; os << ".offset = "; @@ -12433,22 +12431,22 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); os << ", "; os << ".ppRetMap = "; - details::printPtr(os, - *(params->pppRetMap)); + ur::details::printPtr(os, + *(params->pppRetMap)); return os; } @@ -12461,20 +12459,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hMem = "; - details::printPtr(os, - *(params->phMem)); + ur::details::printPtr(os, + *(params->phMem)); os << ", "; os << ".pMappedPtr = "; - details::printPtr(os, - *(params->ppMappedPtr)); + ur::details::printPtr(os, + *(params->ppMappedPtr)); os << ", "; os << ".numEventsInWaitList = "; @@ -12488,16 +12486,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12510,14 +12508,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".ptr = "; - details::printPtr(os, - *(params->pptr)); + ur::details::printPtr(os, + *(params->pptr)); os << ", "; os << ".patternSize = "; @@ -12527,8 +12525,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPattern = "; - details::printPtr(os, - *(params->ppPattern)); + ur::details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".size = "; @@ -12547,16 +12545,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12569,8 +12567,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12580,14 +12578,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".size = "; @@ -12606,16 +12604,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12628,14 +12626,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".size = "; @@ -12645,8 +12643,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); os << ", "; os << ".numEventsInWaitList = "; @@ -12660,16 +12658,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12682,14 +12680,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".size = "; @@ -12699,14 +12697,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".advice = "; - details::printFlag(os, - *(params->padvice)); + ur::details::printFlag(os, + *(params->padvice)); os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12719,14 +12717,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".pitch = "; @@ -12741,8 +12739,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPattern = "; - details::printPtr(os, - *(params->ppPattern)); + ur::details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".width = "; @@ -12766,16 +12764,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12788,8 +12786,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".blocking = "; @@ -12799,8 +12797,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".dstPitch = "; @@ -12810,8 +12808,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".srcPitch = "; @@ -12840,16 +12838,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12862,20 +12860,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".name = "; - details::printPtr(os, - *(params->pname)); + ur::details::printPtr(os, + *(params->pname)); os << ", "; os << ".blockingWrite = "; @@ -12895,8 +12893,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numEventsInWaitList = "; @@ -12910,16 +12908,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -12932,20 +12930,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".name = "; - details::printPtr(os, - *(params->pname)); + ur::details::printPtr(os, + *(params->pname)); os << ", "; os << ".blockingRead = "; @@ -12965,8 +12963,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numEventsInWaitList = "; @@ -12980,16 +12978,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -13002,20 +13000,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - details::printPtr(os, - *(params->ppipe_symbol)); + ur::details::printPtr(os, + *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13025,8 +13023,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".size = "; @@ -13045,16 +13043,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -13067,20 +13065,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hProgram = "; - details::printPtr(os, - *(params->phProgram)); + ur::details::printPtr(os, + *(params->phProgram)); os << ", "; os << ".pipe_symbol = "; - details::printPtr(os, - *(params->ppipe_symbol)); + ur::details::printPtr(os, + *(params->ppipe_symbol)); os << ", "; os << ".blocking = "; @@ -13090,8 +13088,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".size = "; @@ -13110,16 +13108,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -13132,14 +13130,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -13149,20 +13147,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - details::printPtr(os, - *(params->ppGlobalWorkOffset)); + ur::details::printPtr(os, + *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - details::printPtr(os, - *(params->ppGlobalWorkSize)); + ur::details::printPtr(os, + *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - details::printPtr(os, - *(params->ppLocalWorkSize)); + ur::details::printPtr(os, + *(params->ppLocalWorkSize)); os << ", "; os << ".numEventsInWaitList = "; @@ -13176,16 +13174,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -13198,8 +13196,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".propName = "; @@ -13213,13 +13211,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -13232,26 +13230,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phQueue = "; - details::printPtr(os, - *(params->pphQueue)); + ur::details::printPtr(os, + *(params->pphQueue)); return os; } @@ -13264,8 +13262,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); return os; } @@ -13278,8 +13276,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); return os; } @@ -13292,20 +13290,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pDesc = "; - details::printPtr(os, - *(params->ppDesc)); + ur::details::printPtr(os, + *(params->ppDesc)); os << ", "; os << ".phNativeQueue = "; - details::printPtr(os, - *(params->pphNativeQueue)); + ur::details::printPtr(os, + *(params->pphNativeQueue)); return os; } @@ -13318,32 +13316,32 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeQueue = "; - details::printPtr(os, - *(params->phNativeQueue)); + ur::details::printPtr(os, + *(params->phNativeQueue)); os << ", "; os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phQueue = "; - details::printPtr(os, - *(params->pphQueue)); + ur::details::printPtr(os, + *(params->pphQueue)); return os; } @@ -13356,8 +13354,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); return os; } @@ -13370,8 +13368,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); return os; } @@ -13384,20 +13382,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hImage = "; - details::printPtr(os, - *(params->phImage)); + ur::details::printPtr(os, + *(params->phImage)); return os; } @@ -13410,20 +13408,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hImage = "; - details::printPtr(os, - *(params->phImage)); + ur::details::printPtr(os, + *(params->phImage)); return os; } @@ -13436,32 +13434,32 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".phImageMem = "; - details::printPtr(os, - *(params->pphImageMem)); + ur::details::printPtr(os, + *(params->pphImageMem)); return os; } @@ -13474,20 +13472,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hImageMem = "; - details::printPtr(os, - *(params->phImageMem)); + ur::details::printPtr(os, + *(params->phImageMem)); return os; } @@ -13500,44 +13498,44 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hImageMem = "; - details::printPtr(os, - *(params->phImageMem)); + ur::details::printPtr(os, + *(params->phImageMem)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".phMem = "; - details::printPtr(os, - *(params->pphMem)); + ur::details::printPtr(os, + *(params->pphMem)); os << ", "; os << ".phImage = "; - details::printPtr(os, - *(params->pphImage)); + ur::details::printPtr(os, + *(params->pphImage)); return os; } @@ -13550,50 +13548,50 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hImageMem = "; - details::printPtr(os, - *(params->phImageMem)); + ur::details::printPtr(os, + *(params->phImageMem)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".hSampler = "; - details::printPtr(os, - *(params->phSampler)); + ur::details::printPtr(os, + *(params->phSampler)); os << ", "; os << ".phMem = "; - details::printPtr(os, - *(params->pphMem)); + ur::details::printPtr(os, + *(params->pphMem)); os << ", "; os << ".phImage = "; - details::printPtr(os, - *(params->pphImage)); + ur::details::printPtr(os, + *(params->pphImage)); return os; } @@ -13606,38 +13604,38 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".imageCopyFlags = "; - details::printFlag(os, - *(params->pimageCopyFlags)); + ur::details::printFlag(os, + *(params->pimageCopyFlags)); os << ", "; os << ".srcOffset = "; @@ -13671,16 +13669,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -13693,8 +13691,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hImageMem = "; - details::printPtr(os, - *(params->phImageMem)); + ur::details::printPtr(os, + *(params->phImageMem)); os << ", "; os << ".propName = "; @@ -13704,14 +13702,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printPtr(os, - *(params->ppPropValue)); + ur::details::printPtr(os, + *(params->ppPropValue)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -13724,20 +13722,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hImageMem = "; - details::printPtr(os, - *(params->phImageMem)); + ur::details::printPtr(os, + *(params->phImageMem)); os << ", "; os << ".mipmapLevel = "; @@ -13747,8 +13745,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".phImageMem = "; - details::printPtr(os, - *(params->pphImageMem)); + ur::details::printPtr(os, + *(params->pphImageMem)); return os; } @@ -13761,20 +13759,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hMem = "; - details::printPtr(os, - *(params->phMem)); + ur::details::printPtr(os, + *(params->phMem)); return os; } @@ -13787,14 +13785,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".size = "; @@ -13804,14 +13802,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pInteropMemDesc = "; - details::printPtr(os, - *(params->ppInteropMemDesc)); + ur::details::printPtr(os, + *(params->ppInteropMemDesc)); os << ", "; os << ".phInteropMem = "; - details::printPtr(os, - *(params->pphInteropMem)); + ur::details::printPtr(os, + *(params->pphInteropMem)); return os; } @@ -13824,38 +13822,38 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pImageFormat = "; - details::printPtr(os, - *(params->ppImageFormat)); + ur::details::printPtr(os, + *(params->ppImageFormat)); os << ", "; os << ".pImageDesc = "; - details::printPtr(os, - *(params->ppImageDesc)); + ur::details::printPtr(os, + *(params->ppImageDesc)); os << ", "; os << ".hInteropMem = "; - details::printPtr(os, - *(params->phInteropMem)); + ur::details::printPtr(os, + *(params->phInteropMem)); os << ", "; os << ".phImageMem = "; - details::printPtr(os, - *(params->pphImageMem)); + ur::details::printPtr(os, + *(params->pphImageMem)); return os; } @@ -13868,20 +13866,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hInteropMem = "; - details::printPtr(os, - *(params->phInteropMem)); + ur::details::printPtr(os, + *(params->phInteropMem)); return os; } @@ -13894,26 +13892,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pInteropSemaphoreDesc = "; - details::printPtr(os, - *(params->ppInteropSemaphoreDesc)); + ur::details::printPtr(os, + *(params->ppInteropSemaphoreDesc)); os << ", "; os << ".phInteropSemaphore = "; - details::printPtr(os, - *(params->pphInteropSemaphore)); + ur::details::printPtr(os, + *(params->pphInteropSemaphore)); return os; } @@ -13926,20 +13924,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".hInteropSemaphore = "; - details::printPtr(os, - *(params->phInteropSemaphore)); + ur::details::printPtr(os, + *(params->phInteropSemaphore)); return os; } @@ -13952,14 +13950,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hSemaphore = "; - details::printPtr(os, - *(params->phSemaphore)); + ur::details::printPtr(os, + *(params->phSemaphore)); os << ", "; os << ".numEventsInWaitList = "; @@ -13973,16 +13971,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -13995,14 +13993,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".hSemaphore = "; - details::printPtr(os, - *(params->phSemaphore)); + ur::details::printPtr(os, + *(params->phSemaphore)); os << ", "; os << ".numEventsInWaitList = "; @@ -14016,16 +14014,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -14038,20 +14036,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pUSMDesc = "; - details::printPtr(os, - *(params->ppUSMDesc)); + ur::details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - details::printPtr(os, - *(params->ppool)); + ur::details::printPtr(os, + *(params->ppool)); os << ", "; os << ".size = "; @@ -14061,8 +14059,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".ppMem = "; - details::printPtr(os, - *(params->pppMem)); + ur::details::printPtr(os, + *(params->pppMem)); return os; } @@ -14075,26 +14073,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - details::printPtr(os, - *(params->ppUSMDesc)); + ur::details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - details::printPtr(os, - *(params->ppool)); + ur::details::printPtr(os, + *(params->ppool)); os << ", "; os << ".size = "; @@ -14104,8 +14102,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".ppMem = "; - details::printPtr(os, - *(params->pppMem)); + ur::details::printPtr(os, + *(params->pppMem)); return os; } @@ -14118,26 +14116,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - details::printPtr(os, - *(params->ppUSMDesc)); + ur::details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - details::printPtr(os, - *(params->ppool)); + ur::details::printPtr(os, + *(params->ppool)); os << ", "; os << ".size = "; @@ -14147,8 +14145,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".ppMem = "; - details::printPtr(os, - *(params->pppMem)); + ur::details::printPtr(os, + *(params->pppMem)); return os; } @@ -14161,14 +14159,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); return os; } @@ -14181,14 +14179,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".propName = "; @@ -14202,13 +14200,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -14221,20 +14219,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pPoolDesc = "; - details::printPtr(os, - *(params->ppPoolDesc)); + ur::details::printPtr(os, + *(params->ppPoolDesc)); os << ", "; os << ".ppPool = "; - details::printPtr(os, - *(params->pppPool)); + ur::details::printPtr(os, + *(params->pppPool)); return os; } @@ -14247,8 +14245,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".pPool = "; - details::printPtr(os, - *(params->ppPool)); + ur::details::printPtr(os, + *(params->ppPool)); return os; } @@ -14261,8 +14259,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".pPool = "; - details::printPtr(os, - *(params->ppPool)); + ur::details::printPtr(os, + *(params->ppPool)); return os; } @@ -14275,8 +14273,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPool = "; - details::printPtr(os, - *(params->phPool)); + ur::details::printPtr(os, + *(params->phPool)); os << ", "; os << ".propName = "; @@ -14290,13 +14288,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -14309,26 +14307,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pUSMDesc = "; - details::printPtr(os, - *(params->ppUSMDesc)); + ur::details::printPtr(os, + *(params->ppUSMDesc)); os << ", "; os << ".pool = "; - details::printPtr(os, - *(params->ppool)); + ur::details::printPtr(os, + *(params->ppool)); os << ", "; os << ".widthInBytes = "; @@ -14348,14 +14346,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".ppMem = "; - details::printPtr(os, - *(params->pppMem)); + ur::details::printPtr(os, + *(params->pppMem)); os << ", "; os << ".pResultPitch = "; - details::printPtr(os, - *(params->ppResultPitch)); + ur::details::printPtr(os, + *(params->ppResultPitch)); return os; } @@ -14368,14 +14366,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); os << ", "; os << ".size = "; @@ -14393,14 +14391,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pMem = "; - details::printPtr(os, - *(params->ppMem)); + ur::details::printPtr(os, + *(params->ppMem)); return os; } @@ -14413,26 +14411,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pCommandBufferDesc = "; - details::printPtr(os, - *(params->ppCommandBufferDesc)); + ur::details::printPtr(os, + *(params->ppCommandBufferDesc)); os << ", "; os << ".phCommandBuffer = "; - details::printPtr(os, - *(params->pphCommandBuffer)); + ur::details::printPtr(os, + *(params->pphCommandBuffer)); return os; } @@ -14445,8 +14443,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); return os; } @@ -14459,8 +14457,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); return os; } @@ -14473,8 +14471,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); return os; } @@ -14487,14 +14485,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hKernel = "; - details::printPtr(os, - *(params->phKernel)); + ur::details::printPtr(os, + *(params->phKernel)); os << ", "; os << ".workDim = "; @@ -14504,20 +14502,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pGlobalWorkOffset = "; - details::printPtr(os, - *(params->ppGlobalWorkOffset)); + ur::details::printPtr(os, + *(params->ppGlobalWorkOffset)); os << ", "; os << ".pGlobalWorkSize = "; - details::printPtr(os, - *(params->ppGlobalWorkSize)); + ur::details::printPtr(os, + *(params->ppGlobalWorkSize)); os << ", "; os << ".pLocalWorkSize = "; - details::printPtr(os, - *(params->ppLocalWorkSize)); + ur::details::printPtr(os, + *(params->ppLocalWorkSize)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -14527,14 +14525,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14547,20 +14545,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".size = "; @@ -14575,14 +14573,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14595,20 +14593,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".pMemory = "; - details::printPtr(os, - *(params->ppMemory)); + ur::details::printPtr(os, + *(params->ppMemory)); os << ", "; os << ".pPattern = "; - details::printPtr(os, - *(params->ppPattern)); + ur::details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -14628,14 +14626,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14648,20 +14646,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hSrcMem = "; - details::printPtr(os, - *(params->phSrcMem)); + ur::details::printPtr(os, + *(params->phSrcMem)); os << ", "; os << ".hDstMem = "; - details::printPtr(os, - *(params->phDstMem)); + ur::details::printPtr(os, + *(params->phDstMem)); os << ", "; os << ".srcOffset = "; @@ -14686,14 +14684,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14706,14 +14704,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".offset = "; @@ -14728,8 +14726,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -14739,14 +14737,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14759,14 +14757,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".offset = "; @@ -14781,8 +14779,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -14792,14 +14790,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14812,20 +14810,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hSrcMem = "; - details::printPtr(os, - *(params->phSrcMem)); + ur::details::printPtr(os, + *(params->phSrcMem)); os << ", "; os << ".hDstMem = "; - details::printPtr(os, - *(params->phDstMem)); + ur::details::printPtr(os, + *(params->phDstMem)); os << ", "; os << ".srcOrigin = "; @@ -14870,14 +14868,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14890,14 +14888,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".bufferOffset = "; @@ -14937,8 +14935,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSrc = "; - details::printPtr(os, - *(params->ppSrc)); + ur::details::printPtr(os, + *(params->ppSrc)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -14948,14 +14946,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -14968,14 +14966,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".bufferOffset = "; @@ -15015,8 +15013,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pDst = "; - details::printPtr(os, - *(params->ppDst)); + ur::details::printPtr(os, + *(params->ppDst)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -15026,14 +15024,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -15046,20 +15044,20 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hBuffer = "; - details::printPtr(os, - *(params->phBuffer)); + ur::details::printPtr(os, + *(params->phBuffer)); os << ", "; os << ".pPattern = "; - details::printPtr(os, - *(params->ppPattern)); + ur::details::printPtr(os, + *(params->ppPattern)); os << ", "; os << ".patternSize = "; @@ -15084,14 +15082,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -15104,14 +15102,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".pMemory = "; - details::printPtr(os, - *(params->ppMemory)); + ur::details::printPtr(os, + *(params->ppMemory)); os << ", "; os << ".size = "; @@ -15121,8 +15119,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -15132,14 +15130,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -15152,14 +15150,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".pMemory = "; - details::printPtr(os, - *(params->ppMemory)); + ur::details::printPtr(os, + *(params->ppMemory)); os << ", "; os << ".size = "; @@ -15169,8 +15167,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".advice = "; - details::printFlag(os, - *(params->padvice)); + ur::details::printFlag(os, + *(params->padvice)); os << ", "; os << ".numSyncPointsInWaitList = "; @@ -15180,14 +15178,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSyncPointWaitList = "; - details::printPtr(os, - *(params->ppSyncPointWaitList)); + ur::details::printPtr(os, + *(params->ppSyncPointWaitList)); os << ", "; os << ".pSyncPoint = "; - details::printPtr(os, - *(params->ppSyncPoint)); + ur::details::printPtr(os, + *(params->ppSyncPoint)); return os; } @@ -15200,14 +15198,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hCommandBuffer = "; - details::printPtr(os, - *(params->phCommandBuffer)); + ur::details::printPtr(os, + *(params->phCommandBuffer)); os << ", "; os << ".hQueue = "; - details::printPtr(os, - *(params->phQueue)); + ur::details::printPtr(os, + *(params->phQueue)); os << ", "; os << ".numEventsInWaitList = "; @@ -15221,16 +15219,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphEventWaitList))[i]); + ur::details::printPtr(os, + (*(params->pphEventWaitList))[i]); } os << "}"; os << ", "; os << ".phEvent = "; - details::printPtr(os, - *(params->pphEvent)); + ur::details::printPtr(os, + *(params->pphEvent)); return os; } @@ -15243,14 +15241,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".commandDevice = "; - details::printPtr(os, - *(params->pcommandDevice)); + ur::details::printPtr(os, + *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - details::printPtr(os, - *(params->ppeerDevice)); + ur::details::printPtr(os, + *(params->ppeerDevice)); return os; } @@ -15263,14 +15261,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".commandDevice = "; - details::printPtr(os, - *(params->pcommandDevice)); + ur::details::printPtr(os, + *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - details::printPtr(os, - *(params->ppeerDevice)); + ur::details::printPtr(os, + *(params->ppeerDevice)); return os; } @@ -15283,14 +15281,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".commandDevice = "; - details::printPtr(os, - *(params->pcommandDevice)); + ur::details::printPtr(os, + *(params->pcommandDevice)); os << ", "; os << ".peerDevice = "; - details::printPtr(os, - *(params->ppeerDevice)); + ur::details::printPtr(os, + *(params->ppeerDevice)); os << ", "; os << ".propName = "; @@ -15304,13 +15302,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -15323,14 +15321,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".device_flags = "; - details::printFlag(os, - *(params->pdevice_flags)); + ur::details::printFlag(os, + *(params->pdevice_flags)); os << ", "; os << ".hLoaderConfig = "; - details::printPtr(os, - *(params->phLoaderConfig)); + ur::details::printPtr(os, + *(params->phLoaderConfig)); return os; } @@ -15352,14 +15350,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15373,13 +15371,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -15392,14 +15390,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - details::printPtr(os, - *(params->ppStart)); + ur::details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15409,8 +15407,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".ppStart = "; - details::printPtr(os, - *(params->pppStart)); + ur::details::printPtr(os, + *(params->pppStart)); return os; } @@ -15423,14 +15421,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - details::printPtr(os, - *(params->ppStart)); + ur::details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15448,14 +15446,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - details::printPtr(os, - *(params->ppStart)); + ur::details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15465,8 +15463,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".hPhysicalMem = "; - details::printPtr(os, - *(params->phPhysicalMem)); + ur::details::printPtr(os, + *(params->phPhysicalMem)); os << ", "; os << ".offset = "; @@ -15476,8 +15474,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); return os; } @@ -15490,14 +15488,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - details::printPtr(os, - *(params->ppStart)); + ur::details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15515,14 +15513,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - details::printPtr(os, - *(params->ppStart)); + ur::details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15532,8 +15530,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".flags = "; - details::printFlag(os, - *(params->pflags)); + ur::details::printFlag(os, + *(params->pflags)); return os; } @@ -15546,14 +15544,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hContext = "; - details::printPtr(os, - *(params->phContext)); + ur::details::printPtr(os, + *(params->phContext)); os << ", "; os << ".pStart = "; - details::printPtr(os, - *(params->ppStart)); + ur::details::printPtr(os, + *(params->ppStart)); os << ", "; os << ".size = "; @@ -15572,13 +15570,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -15591,8 +15589,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hPlatform = "; - details::printPtr(os, - *(params->phPlatform)); + ur::details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".DeviceType = "; @@ -15611,16 +15609,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphDevices))[i]); + ur::details::printPtr(os, + (*(params->pphDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevices = "; - details::printPtr(os, - *(params->ppNumDevices)); + ur::details::printPtr(os, + *(params->ppNumDevices)); return os; } @@ -15633,8 +15631,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".propName = "; @@ -15648,13 +15646,13 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pPropValue = "; - details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); + ur::details::printTagged(os, *(params->ppPropValue), *(params->ppropName), *(params->ppropSize)); os << ", "; os << ".pPropSizeRet = "; - details::printPtr(os, - *(params->ppPropSizeRet)); + ur::details::printPtr(os, + *(params->ppPropSizeRet)); return os; } @@ -15667,8 +15665,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); return os; } @@ -15681,8 +15679,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); return os; } @@ -15695,14 +15693,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".NumDevices = "; @@ -15716,16 +15714,16 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; } - details::printPtr(os, - (*(params->pphSubDevices))[i]); + ur::details::printPtr(os, + (*(params->pphSubDevices))[i]); } os << "}"; os << ", "; os << ".pNumDevicesRet = "; - details::printPtr(os, - *(params->ppNumDevicesRet)); + ur::details::printPtr(os, + *(params->ppNumDevicesRet)); return os; } @@ -15738,14 +15736,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pBinaries = "; - details::printPtr(os, - *(params->ppBinaries)); + ur::details::printPtr(os, + *(params->ppBinaries)); os << ", "; os << ".NumBinaries = "; @@ -15755,8 +15753,8 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ", "; os << ".pSelectedBinary = "; - details::printPtr(os, - *(params->ppSelectedBinary)); + ur::details::printPtr(os, + *(params->ppSelectedBinary)); return os; } @@ -15769,14 +15767,14 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".phNativeDevice = "; - details::printPtr(os, - *(params->pphNativeDevice)); + ur::details::printPtr(os, + *(params->pphNativeDevice)); return os; } @@ -15789,26 +15787,26 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hNativeDevice = "; - details::printPtr(os, - *(params->phNativeDevice)); + ur::details::printPtr(os, + *(params->phNativeDevice)); os << ", "; os << ".hPlatform = "; - details::printPtr(os, - *(params->phPlatform)); + ur::details::printPtr(os, + *(params->phPlatform)); os << ", "; os << ".pProperties = "; - details::printPtr(os, - *(params->ppProperties)); + ur::details::printPtr(os, + *(params->ppProperties)); os << ", "; os << ".phDevice = "; - details::printPtr(os, - *(params->pphDevice)); + ur::details::printPtr(os, + *(params->pphDevice)); return os; } @@ -15821,25 +15819,25 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct os << ".hDevice = "; - details::printPtr(os, - *(params->phDevice)); + ur::details::printPtr(os, + *(params->phDevice)); os << ", "; os << ".pDeviceTimestamp = "; - details::printPtr(os, - *(params->ppDeviceTimestamp)); + ur::details::printPtr(os, + *(params->ppDeviceTimestamp)); os << ", "; os << ".pHostTimestamp = "; - details::printPtr(os, - *(params->ppHostTimestamp)); + ur::details::printPtr(os, + *(params->ppHostTimestamp)); return os; } -namespace details { +namespace ur::details { /////////////////////////////////////////////////////////////////////////////// // @brief Print pointer value template @@ -15864,10 +15862,9 @@ inline ur_result_t printPtr(std::ostream &os, const T *ptr) { return UR_RESULT_SUCCESS; } -} // namespace details -} // namespace print +} // namespace ur::details -namespace extras { +namespace ur::extras { /////////////////////////////////////////////////////////////////////////////// /// @brief Print function parameters /// @returns @@ -15876,8 +15873,6 @@ namespace extras { /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// - `NULL == params` UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { - using namespace print; - if (!params) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } @@ -16440,7 +16435,6 @@ UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, } return UR_RESULT_SUCCESS; } -} // namespace extras -} // namespace ur +} // namespace ur::extras #endif /* UR_PRINT_HPP */ diff --git a/scripts/templates/print.hpp.mako b/scripts/templates/print.hpp.mako index b4976eaf6b..7c1034089b 100644 --- a/scripts/templates/print.hpp.mako +++ b/scripts/templates/print.hpp.mako @@ -29,15 +29,15 @@ from templates import helper as th ## Mako helper functions ###################################################### <%def name="member(iname, itype, loop)"> %if iname == "pNext": - details::printStruct(os, ${caller.body()}); + ${x}::details::printStruct(os, ${caller.body()}); %elif th.type_traits.is_flags(itype): - details::printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); + ${x}::details::printFlag<${th.type_traits.get_flag_type(itype)}>(os, ${caller.body()}); %elif not loop and th.type_traits.is_pointer(itype): - details::printPtr(os, ${caller.body()}); + ${x}::details::printPtr(os, ${caller.body()}); %elif loop and th.type_traits.is_pointer_to_pointer(itype): - details::printPtr(os, ${caller.body()}); + ${x}::details::printPtr(os, ${caller.body()}); %elif th.type_traits.is_handle(itype): - details::printPtr(os, ${caller.body()}); + ${x}::details::printPtr(os, ${caller.body()}); %elif iname and iname.startswith("pfn"): os << reinterpret_cast(${caller.body()}); %else: @@ -85,7 +85,7 @@ def findMemberType(_item): os << "}"; %elif findMemberType(item) is not None and findMemberType(item)['type'] == "union": os << ".${iname} = "; - details::printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); + ${x}::details::printUnion(os, ${deref}(params${access}${item['name']}), params${access}${th.param_traits.tagged_member(item)}); %elif th.type_traits.is_array(item['type']): os << ".${iname} = {"; for(auto i = 0; i < ${th.type_traits.get_array_length(item['type'])}; i++){ @@ -99,7 +99,7 @@ def findMemberType(_item): os << "}"; %elif typename is not None: os << ".${iname} = "; - details::printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); + ${x}::details::printTagged(os, ${deref}(params${access}${pname}), ${deref}(params${access}${prefix}${typename}), ${deref}(params${access}${prefix}${typename_size})); %else: os << ".${iname} = "; <%call expr="member(iname, itype, False)"> @@ -108,10 +108,8 @@ def findMemberType(_item): %endif -namespace ${x} { -namespace print { ## API functions declarations ################################################# -namespace details { +namespace ${x}::details { template struct is_handle : std::false_type {}; %for spec in specs: %for obj in spec['objects']: @@ -153,7 +151,7 @@ template inline ${x}_result_t printTagged(std::ostream &os, const v %endif %endfor # obj in spec['objects'] %endfor -} // namespace details +} // namespace ${x}::details %for spec in specs: %for obj in spec['objects']: @@ -197,7 +195,7 @@ template inline ${x}_result_t printTagged(std::ostream &os, const v } %endif %if obj.get('typed_etors', False) is True: - namespace details { + namespace ${x}::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ${th.make_enum_name(n, tags, obj)} enum value template <> @@ -258,10 +256,10 @@ template inline ${x}_result_t printTagged(std::ostream &os, const v } return ${X}_RESULT_SUCCESS; } - } // namespace details + } // namespace ${x}::details %elif "structure_type" in obj['name']: - namespace details { + namespace ${x}::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ${th.make_enum_name(n, tags, obj)} struct inline ${x}_result_t printStruct(std::ostream &os, const void *ptr) { @@ -287,11 +285,11 @@ template inline ${x}_result_t printTagged(std::ostream &os, const v } return ${X}_RESULT_SUCCESS; } - } // namespace details + } // namespace ${x}::details %endif %if th.type_traits.is_flags(obj['name']): - namespace details { + namespace ${x}::details { /////////////////////////////////////////////////////////////////////////////// /// @brief Print ${th.make_enum_name(n, tags, obj)} flag template<> @@ -326,7 +324,7 @@ template inline ${x}_result_t printTagged(std::ostream &os, const v } return ${X}_RESULT_SUCCESS; } - } // namespace details + } // namespace ${x}::details %endif ## STRUCT ##################################################################### %elif re.match(r"struct", obj['type']): @@ -352,7 +350,7 @@ inline std::ostream &operator<<(std::ostream &os, const ${obj['type']} ${th.make } ## UNION ###################################################################### %elif re.match(r"union", obj['type']) and obj['name']: -namespace details { +namespace ${x}::details { <% tag = findUnionTag(obj) %> /////////////////////////////////////////////////////////////////////////////// // @brief Print ${th.make_type_name(n, tags, obj)} union @@ -382,7 +380,7 @@ for item in obj['members']: os << "}"; return ${X}_RESULT_SUCCESS; } -} // namespace details +} // namespace ${x}::details %endif %endfor # obj in spec['objects'] %endfor @@ -411,7 +409,7 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct %endfor %endfor -namespace details { +namespace ${x}::details { /////////////////////////////////////////////////////////////////////////////// // @brief Print pointer value template inline ${x}_result_t printPtr(std::ostream &os, const T *ptr) { @@ -435,10 +433,9 @@ template inline ${x}_result_t printPtr(std::ostream &os, const T *p return ${X}_RESULT_SUCCESS; } -} // namespace details -} // namespace print +} // namespace ${x}::details -namespace extras { +namespace ${x}::extras { /////////////////////////////////////////////////////////////////////////////// /// @brief Print function parameters /// @returns @@ -447,8 +444,6 @@ namespace extras { /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - `NULL == params` ${X}_APIEXPORT inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { - using namespace print; - if (!params) { return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; } @@ -465,7 +460,6 @@ ${X}_APIEXPORT inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostrea } return ${X}_RESULT_SUCCESS; } -} // namespace extras -} // namespace ${x} +} // namespace ${x}::extras #endif /* ${X}_PRINT_HPP */ diff --git a/source/common/logger/ur_sinks.hpp b/source/common/logger/ur_sinks.hpp index 925a5acc9a..cb8c751e4d 100644 --- a/source/common/logger/ur_sinks.hpp +++ b/source/common/logger/ur_sinks.hpp @@ -16,7 +16,6 @@ #include "ur_print.hpp" namespace logger { -using namespace ur::print; class Sink { public: diff --git a/test/loader/loader_lifetime/urLoaderInit.cpp b/test/loader/loader_lifetime/urLoaderInit.cpp index 693cf273f2..dc1fdfa8ce 100644 --- a/test/loader/loader_lifetime/urLoaderInit.cpp +++ b/test/loader/loader_lifetime/urLoaderInit.cpp @@ -17,7 +17,7 @@ INSTANTIATE_TEST_SUITE_P( UR_DEVICE_INIT_FLAG_FPGA | UR_DEVICE_INIT_FLAG_VPU), [](const ::testing::TestParamInfo &info) { std::stringstream ss; - ur::print::details::printFlag(ss, info.param); + ur::details::printFlag(ss, info.param); return GTestSanitizeString(ss.str()); }); diff --git a/test/unit/utils/params.cpp b/test/unit/utils/params.cpp index 82a7d946d4..6b687e6878 100644 --- a/test/unit/utils/params.cpp +++ b/test/unit/utils/params.cpp @@ -405,7 +405,6 @@ typedef Types Date: Thu, 23 Nov 2023 22:01:39 -0800 Subject: [PATCH 113/145] update template file --- scripts/templates/ldrddi.cpp.mako | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/templates/ldrddi.cpp.mako b/scripts/templates/ldrddi.cpp.mako index 0498ba00dc..c548b14b32 100644 --- a/scripts/templates/ldrddi.cpp.mako +++ b/scripts/templates/ldrddi.cpp.mako @@ -86,6 +86,9 @@ namespace ur_loader break; } adapterIndex++; + if (adapterIndex == NumEntries) { + break; + } } } From 712d79120e0a9293daf5741f9c0b5269ddd862ce Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 24 Nov 2023 12:34:51 +0000 Subject: [PATCH 114/145] Set version to v0.8.0 --- CMakeLists.txt | 2 +- include/ur.py | 5 +++-- include/ur_api.h | 5 +++-- include/ur_ddi.h | 2 +- scripts/Doxyfile | 2 +- scripts/core/platform.yml | 3 +++ scripts/parse_specs.py | 4 ++-- source/ur_api.cpp | 2 +- 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fcf19a65bb..00250d6b99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR) -project(unified-runtime VERSION 0.7.0) +project(unified-runtime VERSION 0.8.0) include(GNUInstallDirs) include(CheckCXXSourceCompiles) diff --git a/include/ur.py b/include/ur.py index 45ce583f42..ac57a3cc0d 100644 --- a/include/ur.py +++ b/include/ur.py @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @file ur.py - @version v0.7-r0 + @version v0.8-r0 """ import platform @@ -573,7 +573,8 @@ def __str__(self): class ur_api_version_v(IntEnum): _0_6 = UR_MAKE_VERSION( 0, 6 ) ## version 0.6 _0_7 = UR_MAKE_VERSION( 0, 7 ) ## version 0.7 - CURRENT = UR_MAKE_VERSION( 0, 7 ) ## latest known version + _0_8 = UR_MAKE_VERSION( 0, 8 ) ## version 0.8 + CURRENT = UR_MAKE_VERSION( 0, 8 ) ## latest known version class ur_api_version_t(c_int): def __str__(self): diff --git a/include/ur_api.h b/include/ur_api.h index 11a0c697d2..2ff218b764 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_api.h - * @version v0.7-r0 + * @version v0.8-r0 * */ #ifndef UR_API_H_INCLUDED @@ -1025,7 +1025,8 @@ urPlatformGetInfo( typedef enum ur_api_version_t { UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), ///< version 0.6 UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), ///< version 0.7 - UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 7), ///< latest known version + UR_API_VERSION_0_8 = UR_MAKE_VERSION(0, 8), ///< version 0.8 + UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 8), ///< latest known version /// @cond UR_API_VERSION_FORCE_UINT32 = 0x7fffffff /// @endcond diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 24d5427191..1fd6a72524 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_ddi.h - * @version v0.7-r0 + * @version v0.8-r0 * */ #ifndef UR_DDI_H_INCLUDED diff --git a/scripts/Doxyfile b/scripts/Doxyfile index c038d5276d..0134f27418 100644 --- a/scripts/Doxyfile +++ b/scripts/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "Intel One API Unified Runtime API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v0.7 +PROJECT_NUMBER = v0.8 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/scripts/core/platform.yml b/scripts/core/platform.yml index f7020b4138..dbbbe312a9 100644 --- a/scripts/core/platform.yml +++ b/scripts/core/platform.yml @@ -133,6 +133,9 @@ etors: - name: "0_7" value: "$X_MAKE_VERSION( 0, 7 )" desc: "version 0.7" + - name: "0_8" + value: "$X_MAKE_VERSION( 0, 8 )" + desc: "version 0.8" --- #-------------------------------------------------------------------------- type: function desc: "Returns the API version supported by the specified platform" diff --git a/scripts/parse_specs.py b/scripts/parse_specs.py index 07ae086efd..414b25d8e0 100644 --- a/scripts/parse_specs.py +++ b/scripts/parse_specs.py @@ -18,8 +18,8 @@ import ctypes import itertools -default_version = "0.7" -all_versions = ["0.6", "0.7"] +default_version = "0.8" +all_versions = ["0.6", "0.7", "0.8"] """ preprocess object diff --git a/source/ur_api.cpp b/source/ur_api.cpp index bc5b473cf9..3e6807d147 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_api.cpp - * @version v0.7-r0 + * @version v0.8-r0 * */ #include "ur_api.h" From 7074cf942413e4418ea24a2f0e0c36a65f7fd91b Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Fri, 24 Nov 2023 12:39:37 +0000 Subject: [PATCH 115/145] [CMake] Bump version to v0.9.0 --- CMakeLists.txt | 2 +- include/ur.py | 5 +++-- include/ur_api.h | 5 +++-- include/ur_ddi.h | 2 +- scripts/Doxyfile | 2 +- scripts/core/platform.yml | 3 +++ scripts/parse_specs.py | 4 ++-- source/ur_api.cpp | 2 +- 8 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 00250d6b99..16a96afb72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception cmake_minimum_required(VERSION 3.14.0 FATAL_ERROR) -project(unified-runtime VERSION 0.8.0) +project(unified-runtime VERSION 0.9.0) include(GNUInstallDirs) include(CheckCXXSourceCompiles) diff --git a/include/ur.py b/include/ur.py index ac57a3cc0d..276bede911 100644 --- a/include/ur.py +++ b/include/ur.py @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @file ur.py - @version v0.8-r0 + @version v0.9-r0 """ import platform @@ -574,7 +574,8 @@ class ur_api_version_v(IntEnum): _0_6 = UR_MAKE_VERSION( 0, 6 ) ## version 0.6 _0_7 = UR_MAKE_VERSION( 0, 7 ) ## version 0.7 _0_8 = UR_MAKE_VERSION( 0, 8 ) ## version 0.8 - CURRENT = UR_MAKE_VERSION( 0, 8 ) ## latest known version + _0_9 = UR_MAKE_VERSION( 0, 9 ) ## version 0.9 + CURRENT = UR_MAKE_VERSION( 0, 9 ) ## latest known version class ur_api_version_t(c_int): def __str__(self): diff --git a/include/ur_api.h b/include/ur_api.h index 2ff218b764..c5989cee3f 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_api.h - * @version v0.8-r0 + * @version v0.9-r0 * */ #ifndef UR_API_H_INCLUDED @@ -1026,7 +1026,8 @@ typedef enum ur_api_version_t { UR_API_VERSION_0_6 = UR_MAKE_VERSION(0, 6), ///< version 0.6 UR_API_VERSION_0_7 = UR_MAKE_VERSION(0, 7), ///< version 0.7 UR_API_VERSION_0_8 = UR_MAKE_VERSION(0, 8), ///< version 0.8 - UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 8), ///< latest known version + UR_API_VERSION_0_9 = UR_MAKE_VERSION(0, 9), ///< version 0.9 + UR_API_VERSION_CURRENT = UR_MAKE_VERSION(0, 9), ///< latest known version /// @cond UR_API_VERSION_FORCE_UINT32 = 0x7fffffff /// @endcond diff --git a/include/ur_ddi.h b/include/ur_ddi.h index 1fd6a72524..1c3d8a35c6 100644 --- a/include/ur_ddi.h +++ b/include/ur_ddi.h @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_ddi.h - * @version v0.8-r0 + * @version v0.9-r0 * */ #ifndef UR_DDI_H_INCLUDED diff --git a/scripts/Doxyfile b/scripts/Doxyfile index 0134f27418..4a07fdb103 100644 --- a/scripts/Doxyfile +++ b/scripts/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "Intel One API Unified Runtime API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = v0.8 +PROJECT_NUMBER = v0.9 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/scripts/core/platform.yml b/scripts/core/platform.yml index dbbbe312a9..bb7dbfa050 100644 --- a/scripts/core/platform.yml +++ b/scripts/core/platform.yml @@ -136,6 +136,9 @@ etors: - name: "0_8" value: "$X_MAKE_VERSION( 0, 8 )" desc: "version 0.8" + - name: "0_9" + value: "$X_MAKE_VERSION( 0, 9 )" + desc: "version 0.9" --- #-------------------------------------------------------------------------- type: function desc: "Returns the API version supported by the specified platform" diff --git a/scripts/parse_specs.py b/scripts/parse_specs.py index 414b25d8e0..4991119dd3 100644 --- a/scripts/parse_specs.py +++ b/scripts/parse_specs.py @@ -18,8 +18,8 @@ import ctypes import itertools -default_version = "0.8" -all_versions = ["0.6", "0.7", "0.8"] +default_version = "0.9" +all_versions = ["0.6", "0.7", "0.8", "0.9"] """ preprocess object diff --git a/source/ur_api.cpp b/source/ur_api.cpp index 3e6807d147..40a6aded00 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -7,7 +7,7 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * * @file ur_api.cpp - * @version v0.8-r0 + * @version v0.9-r0 * */ #include "ur_api.h" From 9f4b0a60a6ad8977b603a822014fa852870b0fab Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 8 Nov 2023 14:38:29 +0000 Subject: [PATCH 116/145] [OpenCL] Fetch headers/icd-loader by default Introduces the follow CMake options: * `UR_OPENCL_INCLUDE_DIR` - directory containing the OpenCL Headers * `UR_OPENCL_ICD_LOADER_LIBRARY` - path of the OpenCL ICD Loader library In the event that `UR_OPENCL_INCLUDE_DIR` is not specified, clone [KhronosGroup/OpenCL-Headers](https://github.com/KhronosGroup/OpenCL-Headers.git). In the event that `UR_OPENCL_ICD_LOADER_LIBRARY` is not specified, first inspect the system with `find_package(OpenCL 3.0)` and use that if found. Otherwise, clone [KhronosGroup/OpenCL-ICD-Loader](https://github.com/KhronosGroup/OpenCL-ICD-Loader.git). --- source/adapters/opencl/CMakeLists.txt | 123 ++++++++++++++++---------- 1 file changed, 77 insertions(+), 46 deletions(-) diff --git a/source/adapters/opencl/CMakeLists.txt b/source/adapters/opencl/CMakeLists.txt index dc43a68ffa..5feb673175 100644 --- a/source/adapters/opencl/CMakeLists.txt +++ b/source/adapters/opencl/CMakeLists.txt @@ -5,65 +5,96 @@ set(OPENCL_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "OpenCL adapter directory") +set(UR_OPENCL_INCLUDE_DIR "" CACHE PATH "Directory containing the OpenCL Headers") +set(UR_OPENCL_ICD_LOADER_LIBRARY "" CACHE FILEPATH "Path of the OpenCL ICD Loader library") + +find_package(Threads REQUIRED) + set(TARGET_NAME ur_adapter_opencl) -add_ur_adapter(${TARGET_NAME} - SHARED - ${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/common.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/context.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/context.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/device.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/enqueue.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/event.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/image.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/memory.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/program.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/queue.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/sampler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/usm.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/usm_p2p.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.hpp +add_ur_adapter(${TARGET_NAME} SHARED + ${CMAKE_CURRENT_SOURCE_DIR}/ur_interface_loader.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/adapter.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/adapter.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/command_buffer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/common.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/common.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/context.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/context.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/device.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/enqueue.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/event.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/image.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/memory.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/platform.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/platform.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/program.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/queue.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/sampler.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/usm.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/usm_p2p.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../../ur/ur.hpp ) set_target_properties(${TARGET_NAME} PROPERTIES - VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" - SOVERSION "${PROJECT_VERSION_MAJOR}" + VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}" + SOVERSION "${PROJECT_VERSION_MAJOR}" ) -find_package(Threads REQUIRED) +if(UR_OPENCL_INCLUDE_DIR) + set(OpenCLIncludeDirectory ${UR_OPENCL_INCLUDE_DIR}) +else() + FetchContent_Declare(OpenCL-Headers + GIT_REPOSITORY "https://github.com/KhronosGroup/OpenCL-Headers.git" + GIT_TAG main + ) + FetchContent_MakeAvailable(OpenCL-Headers) + FetchContent_GetProperties(OpenCL-Headers + SOURCE_DIR OpenCLIncludeDirectory + ) +endif() -# The OpenCL target can be set manually on upstream cmake to avoid using find_package(). -if (NOT UR_OPENCL_ICD_LOADER_LIBRARY) - find_package(OpenCL REQUIRED) - message(STATUS "OpenCL_LIBRARY: ${OpenCL_LIBRARY}") - message(STATUS "OpenCL_INCLUDE_DIR: ${OpenCL_INCLUDE_DIR}") - set(UR_OPENCL_ICD_LOADER_LIBRARY OpenCL::OpenCL) +# The OpenCL target can be set manually on upstream cmake to avoid using +# find_package(). +if(UR_OPENCL_ICD_LOADER_LIBRARY) + set(OpenCLICDLoaderLibrary ${UR_OPENCL_ICD_LOADER_LIBRARY}) +else() + find_package(OpenCL 3.0) + if(OpenCL_FOUND) + set(OpenCLICDLoaderLibrary OpenCL::OpenCL) + else() + FetchContent_Declare(OpenCL-ICD-Loader + GIT_REPOSITORY "https://github.com/KhronosGroup/OpenCL-ICD-Loader.git" + GIT_TAG main + ) + FetchContent_MakeAvailable(OpenCL-ICD-Loader) + set(OpenCLICDLoaderLibrary ${PROJECT_BINARY_DIR}/lib/libOpenCL.so) + endif() endif() +message(STATUS "OpenCL Include Directory: ${OpenCLIncludeDirectory}") +message(STATUS "OpenCL ICD Loader Library: ${OpenCLICDLoaderLibrary}") + # Suppress a compiler message about undefined CL_TARGET_OPENCL_VERSION. # Define all symbols up to OpenCL 3.0. -target_compile_definitions(ur_adapter_opencl PRIVATE CL_TARGET_OPENCL_VERSION=300 CL_USE_DEPRECATED_OPENCL_1_2_APIS) - -target_link_libraries(${TARGET_NAME} PRIVATE - ${PROJECT_NAME}::headers - ${PROJECT_NAME}::common - ${PROJECT_NAME}::unified_malloc_framework - Threads::Threads - ${UR_OPENCL_ICD_LOADER_LIBRARY} +target_compile_definitions(ur_adapter_opencl PRIVATE + CL_TARGET_OPENCL_VERSION=300 + CL_USE_DEPRECATED_OPENCL_1_2_APIS ) target_include_directories(${TARGET_NAME} PRIVATE - "${CMAKE_CURRENT_SOURCE_DIR}/../../" - ${OpenCL_INCLUDE_DIR} + ${OpenCLIncludeDirectory} + "${CMAKE_CURRENT_SOURCE_DIR}/../../" +) + +target_link_libraries(${TARGET_NAME} PRIVATE + ${PROJECT_NAME}::headers + ${PROJECT_NAME}::common + ${PROJECT_NAME}::unified_malloc_framework + Threads::Threads + ${OpenCLICDLoaderLibrary} ) From 8a0567490681893306a641889147bfc8ecb57fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mestre?= Date: Thu, 16 Nov 2023 14:56:00 +0000 Subject: [PATCH 117/145] [CI] Add support for OpenCL CI on CPU --- .github/workflows/cmake.yml | 9 ++-- .../context/context_adapter_opencl.match | 1 + .../device/device_adapter_opencl.match | 3 ++ .../enqueue/enqueue_adapter_opencl.match | 5 +++ .../event/event_adapter_opencl.match | 2 + .../kernel/kernel_adapter_opencl.match | 1 + .../memory/memory_adapter_opencl.match | 5 +++ .../platform/platform_adapter_opencl.match | 1 + .../program/program_adapter_opencl.match | 30 +++++++++++++ .../queue/queue_adapter_opencl.match | 4 ++ .../runtime/runtime_adapter_opencl.match | 0 .../sampler/sampler_adapter_opencl.match | 0 test/conformance/source/environment.cpp | 10 +++++ test/conformance/usm/usm_adapter_opencl.match | 42 +++++++++++++++++++ .../virtual_memory_adapter_opencl.match | 15 +++++++ 15 files changed, 124 insertions(+), 4 deletions(-) create mode 100644 test/conformance/context/context_adapter_opencl.match create mode 100644 test/conformance/device/device_adapter_opencl.match create mode 100644 test/conformance/enqueue/enqueue_adapter_opencl.match create mode 100644 test/conformance/event/event_adapter_opencl.match create mode 100644 test/conformance/kernel/kernel_adapter_opencl.match create mode 100644 test/conformance/memory/memory_adapter_opencl.match create mode 100644 test/conformance/platform/platform_adapter_opencl.match create mode 100644 test/conformance/program/program_adapter_opencl.match create mode 100644 test/conformance/queue/queue_adapter_opencl.match create mode 100644 test/conformance/runtime/runtime_adapter_opencl.match create mode 100644 test/conformance/sampler/sampler_adapter_opencl.match create mode 100644 test/conformance/usm/usm_adapter_opencl.match create mode 100644 test/conformance/virtual_memory/virtual_memory_adapter_opencl.match diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 780f142f33..665f30b9a9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -163,9 +163,10 @@ jobs: strategy: matrix: adapter: [ - {name: CUDA, triplet: nvptx64-nvidia-cuda}, - {name: HIP, triplet: amdgcn-amd-amdhsa}, - {name: L0, triplet: spir64} + {name: CUDA, triplet: nvptx64-nvidia-cuda, platform: ""}, + {name: HIP, triplet: amdgcn-amd-amdhsa, platform: ""}, + {name: L0, triplet: spir64, platform: ""}, + {name: OPENCL, triplet: spir64, platform: "Intel(R) OpenCL"} ] build_type: [Debug, Release] compiler: [{c: gcc, cxx: g++}, {c: clang, cxx: clang++}] @@ -219,7 +220,7 @@ jobs: - name: Test adapters if: matrix.adapter.name != 'L0' working-directory: ${{github.workspace}}/build - run: ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180 + run: env UR_CTS_ADAPTER_PLATFORM="${{matrix.adapter.platform}}" ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180 examples-build-hw: name: Build - examples on HW diff --git a/test/conformance/context/context_adapter_opencl.match b/test/conformance/context/context_adapter_opencl.match new file mode 100644 index 0000000000..0f0e82d7d9 --- /dev/null +++ b/test/conformance/context/context_adapter_opencl.match @@ -0,0 +1 @@ +urContextCreateWithNativeHandleTest.Success/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/device/device_adapter_opencl.match b/test/conformance/device/device_adapter_opencl.match new file mode 100644 index 0000000000..b46c34d6ca --- /dev/null +++ b/test/conformance/device/device_adapter_opencl.match @@ -0,0 +1,3 @@ +urDeviceGetTest.InvalidValueNumEntries +urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HALF_FP_CONFIG +urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE diff --git a/test/conformance/enqueue/enqueue_adapter_opencl.match b/test/conformance/enqueue/enqueue_adapter_opencl.match new file mode 100644 index 0000000000..58bfd87643 --- /dev/null +++ b/test/conformance/enqueue/enqueue_adapter_opencl.match @@ -0,0 +1,5 @@ +{{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueMemBufferCopyRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueMemBufferReadRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueMemBufferWriteRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}Segmentation fault diff --git a/test/conformance/event/event_adapter_opencl.match b/test/conformance/event/event_adapter_opencl.match new file mode 100644 index 0000000000..43bd5fe2ed --- /dev/null +++ b/test/conformance/event/event_adapter_opencl.match @@ -0,0 +1,2 @@ +urEventSetCallbackTest.AllStates/Intel_R__OpenCL___{{.*}}_ +urEventSetCallbackNegativeTest.InvalidNullHandle/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/kernel/kernel_adapter_opencl.match b/test/conformance/kernel/kernel_adapter_opencl.match new file mode 100644 index 0000000000..7a1c0d5b8e --- /dev/null +++ b/test/conformance/kernel/kernel_adapter_opencl.match @@ -0,0 +1 @@ +Segmentation fault diff --git a/test/conformance/memory/memory_adapter_opencl.match b/test/conformance/memory/memory_adapter_opencl.match new file mode 100644 index 0000000000..f6df605fa6 --- /dev/null +++ b/test/conformance/memory/memory_adapter_opencl.match @@ -0,0 +1,5 @@ +urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_SIZE +urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_CONTEXT +urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_SIZE +urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_CONTEXT +urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/platform/platform_adapter_opencl.match b/test/conformance/platform/platform_adapter_opencl.match new file mode 100644 index 0000000000..df63fbef05 --- /dev/null +++ b/test/conformance/platform/platform_adapter_opencl.match @@ -0,0 +1 @@ +urPlatformGetTest.InvalidNumEntries diff --git a/test/conformance/program/program_adapter_opencl.match b/test/conformance/program/program_adapter_opencl.match new file mode 100644 index 0000000000..1354f1f211 --- /dev/null +++ b/test/conformance/program/program_adapter_opencl.match @@ -0,0 +1,30 @@ +urProgramCreateWithBinaryTest.Success/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullPointerBinary/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullPointerProgram/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidNullPointerMetadata/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithBinaryTest.InvalidSizePropertyCount/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/Intel_R__OpenCL___{{.*}}_ +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_OPTIONS +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_LOG +urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_OPTIONS +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_LOG +urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE +urProgramGetFunctionPointerTest.InvalidFunctionName/Intel_R__OpenCL___{{.*}}_ +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_REFERENCE_COUNT +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_CONTEXT +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_DEVICES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_DEVICES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARY_SIZES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARIES +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS +urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES diff --git a/test/conformance/queue/queue_adapter_opencl.match b/test/conformance/queue/queue_adapter_opencl.match new file mode 100644 index 0000000000..59c11b7c86 --- /dev/null +++ b/test/conformance/queue/queue_adapter_opencl.match @@ -0,0 +1,4 @@ +urQueueCreateTest.InvalidQueueProperties/Intel_R__OpenCL___{{.*}}_ +urQueueCreateWithNativeHandleTest.Success/Intel_R__OpenCL___{{.*}}_ +urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_SIZE +urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_EMPTY diff --git a/test/conformance/runtime/runtime_adapter_opencl.match b/test/conformance/runtime/runtime_adapter_opencl.match new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/conformance/sampler/sampler_adapter_opencl.match b/test/conformance/sampler/sampler_adapter_opencl.match new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 875ceb63ef..8e99983c9b 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -179,6 +179,16 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) { std::string(&arg[std::strlen("--platform=")]); } } + + /* If a platform was not provided using the --platform command line option, + * check if environment variable is set to use as a fallback. */ + if (options.platform_name.empty()) { + const char *env_platform = std::getenv("UR_CTS_ADAPTER_PLATFORM"); + if (env_platform) { + options.platform_name = env_platform; + } + } + return options; } diff --git a/test/conformance/usm/usm_adapter_opencl.match b/test/conformance/usm/usm_adapter_opencl.match new file mode 100644 index 0000000000..b9aa3f3bdf --- /dev/null +++ b/test/conformance/usm/usm_adapter_opencl.match @@ -0,0 +1,42 @@ +urUSMDeviceAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolDisabled +urUSMDeviceAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidNullPtrResult/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMDeviceAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMAllocInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_USM_ALLOC_INFO_POOL +urUSMHostAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolDisabled +urUSMHostAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.InvalidNullPtrMem/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMHostAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMPoolCreateTest.Success/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.SuccessWithFlag/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidNullPointerPoolDesc/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidNullPointerPool/Intel_R__OpenCL___{{.*}}_ +urUSMPoolCreateTest.InvalidEnumerationFlags/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_USM_POOL_INFO_CONTEXT +urUSMPoolGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_USM_POOL_INFO_REFERENCE_COUNT +urUSMPoolGetInfoTest.InvalidNullHandlePool/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidEnumerationProperty/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidSizeZero/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidSizeTooSmall/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidNullPointerPropValue/Intel_R__OpenCL___{{.*}}_ +urUSMPoolGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}_ +urUSMPoolDestroyTest.Success/Intel_R__OpenCL___{{.*}}_ +urUSMPoolDestroyTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urUSMPoolRetainTest.Success/Intel_R__OpenCL___{{.*}}_ +urUSMPoolRetainTest.InvalidNullHandlePool/Intel_R__OpenCL___{{.*}}_ +urUSMSharedAllocTest.Success/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.SuccessWithDescriptors/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.SuccessWithMultipleAdvices/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidNullPtrMem/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidUSMSize/Intel_R__OpenCL___{{.*}}___UsePoolEnabled +urUSMSharedAllocTest.InvalidValueAlignPowerOfTwo/Intel_R__OpenCL___{{.*}}___UsePoolEnabled diff --git a/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match b/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match new file mode 100644 index 0000000000..bf82e6fb92 --- /dev/null +++ b/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match @@ -0,0 +1,15 @@ +urVirtualMemGetInfoTestWithParam.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_INFO_ACCESS_MODE +urVirtualMemGetInfoTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGetInfoTest.InvalidNullPointerStart/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGetInfoTest.InvalidEnumerationInfo/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM +urVirtualMemGranularityGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED +urVirtualMemGranularityGetInfoNegativeTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidEnumeration/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidNullPointerPropValue/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidPropSizeZero/Intel_R__OpenCL___{{.*}}_ +urVirtualMemGranularityGetInfoNegativeTest.InvalidSizePropSizeSmall/Intel_R__OpenCL___{{.*}}_ +urVirtualMemSetAccessTest.Success/Intel_R__OpenCL___{{.*}}_ +urVirtualMemSetAccessTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ +urVirtualMemSetAccessTest.InvalidNullPointerStart/Intel_R__OpenCL___{{.*}}_ From 0c4585f8867709b210af67da262e4906fa87c2eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mestre?= Date: Mon, 20 Nov 2023 12:52:38 +0000 Subject: [PATCH 118/145] Fix windows build --- test/conformance/source/environment.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 8e99983c9b..c47de93e7f 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -14,6 +14,7 @@ #include #include +#include namespace uur { @@ -183,9 +184,9 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) { /* If a platform was not provided using the --platform command line option, * check if environment variable is set to use as a fallback. */ if (options.platform_name.empty()) { - const char *env_platform = std::getenv("UR_CTS_ADAPTER_PLATFORM"); - if (env_platform) { - options.platform_name = env_platform; + auto env_platform = ur_getenv("UR_CTS_ADAPTER_PLATFORM"); + if (env_platform.has_value()) { + options.platform_name = env_platform.value(); } } From 6502de1eb7d6fe096f92d48283c13ee43a809d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Mestre?= Date: Mon, 20 Nov 2023 13:45:51 +0000 Subject: [PATCH 119/145] Fix formatting --- test/conformance/source/environment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index c47de93e7f..5fe7d9b352 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -12,9 +12,9 @@ #include "kernel_entry_points.h" #endif +#include #include #include -#include namespace uur { From a22fdddfde3eb1be121720e5ebcc4455570a6fad Mon Sep 17 00:00:00 2001 From: Patryk Kaminski Date: Thu, 23 Nov 2023 13:27:37 +0100 Subject: [PATCH 120/145] Remove printing API functions exports Remove exporting operators and functions from the loader's library file. All of these are both declared and defined in the header and there is no use case for pointers to print API functions and operators. --- include/ur_print.hpp | 234 +++++++++++++++---------------- scripts/templates/print.hpp.mako | 6 +- 2 files changed, 120 insertions(+), 120 deletions(-) diff --git a/include/ur_print.hpp b/include/ur_print.hpp index 2a4851e770..5c240f2c3e 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -204,122 +204,122 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr, ur_exp_peer_in } // namespace ur::details -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_function_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_result_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_base_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_base_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_offset_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_region_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_init_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_loader_config_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_code_location_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_adapter_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_adapter_backend_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_platform_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_api_version_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_platform_backend_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_binary_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_affinity_domain_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_partition_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_property_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_fp_capability_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_mem_cache_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_local_mem_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_exec_capability_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_memory_order_capability_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_memory_scope_capability_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_device_usm_access_capability_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_context_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_context_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_mem_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_mem_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_mem_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_image_channel_order_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_image_channel_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_image_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_image_format_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_image_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_channel_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_alloc_location_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_region_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_buffer_create_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_sampler_filter_mode_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_sampler_addressing_mode_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_sampler_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_host_mem_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_device_mem_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_alloc_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_host_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_device_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_granularity_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_access_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_physical_mem_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_metadata_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_metadata_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_build_status_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_binary_type_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_program_build_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_specialization_constant_info_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_value_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_local_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_group_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_sub_group_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_cache_config_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_kernel_exec_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_pointer_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_exec_info_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_sampler_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_mem_obj_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_queue_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_queue_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_index_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_native_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_command_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_event_status_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_event_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_profiling_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_native_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_execution_info_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_map_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_usm_migration_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_exp_image_copy_flag_t value); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_file_descriptor_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_win32_handle_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_layered_image_properties_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); -UR_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_function_t value); +inline std::ostream &operator<<(std::ostream &os, ur_structure_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_result_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_base_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_base_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_offset_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_rect_region_t params); +inline std::ostream &operator<<(std::ostream &os, ur_device_init_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_loader_config_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_code_location_t params); +inline std::ostream &operator<<(std::ostream &os, ur_adapter_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_adapter_backend_t value); +inline std::ostream &operator<<(std::ostream &os, ur_platform_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_api_version_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_platform_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_platform_backend_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_binary_t params); +inline std::ostream &operator<<(std::ostream &os, ur_device_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_affinity_domain_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_partition_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_property_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_partition_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_device_fp_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_mem_cache_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_local_mem_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_exec_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_device_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_memory_order_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_memory_scope_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_device_usm_access_capability_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_context_flag_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_context_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_context_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_mem_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_mem_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_image_channel_order_t value); +inline std::ostream &operator<<(std::ostream &os, ur_image_channel_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_image_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_image_format_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_image_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_channel_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_alloc_location_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_buffer_region_t params); +inline std::ostream &operator<<(std::ostream &os, ur_buffer_create_type_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_mem_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_sampler_filter_mode_t value); +inline std::ostream &operator<<(std::ostream &os, ur_sampler_addressing_mode_t value); +inline std::ostream &operator<<(std::ostream &os, ur_sampler_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_sampler_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_usm_host_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_usm_device_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_usm_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_usm_alloc_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_host_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_device_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_usm_pool_limits_desc_t params); +inline std::ostream &operator<<(std::ostream &os, ur_usm_pool_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_granularity_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_access_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_virtual_mem_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_physical_mem_flag_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_physical_mem_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_program_metadata_type_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_metadata_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_program_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_program_build_status_t value); +inline std::ostream &operator<<(std::ostream &os, ur_program_binary_type_t value); +inline std::ostream &operator<<(std::ostream &os, ur_program_build_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_specialization_constant_info_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_program_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_value_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_local_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_kernel_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_kernel_group_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_kernel_sub_group_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_kernel_cache_config_t value); +inline std::ostream &operator<<(std::ostream &os, ur_kernel_exec_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_pointer_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_exec_info_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_sampler_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_arg_mem_obj_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_kernel_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_queue_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_queue_flag_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_index_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_native_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_queue_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_command_t value); +inline std::ostream &operator<<(std::ostream &os, ur_event_status_t value); +inline std::ostream &operator<<(std::ostream &os, ur_event_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_profiling_info_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_event_native_properties_t params); +inline std::ostream &operator<<(std::ostream &os, ur_execution_info_t value); +inline std::ostream &operator<<(std::ostream &os, ur_map_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_usm_migration_flag_t value); +inline std::ostream &operator<<(std::ostream &os, ur_exp_image_copy_flag_t value); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_file_descriptor_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_win32_handle_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_mip_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_sampler_addr_modes_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_mem_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_interop_semaphore_desc_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_layered_image_properties_t params); +inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct ur_exp_command_buffer_desc_t params); +inline std::ostream &operator<<(std::ostream &os, ur_exp_peer_info_t value); /////////////////////////////////////////////////////////////////////////////// /// @brief Print operator for the ur_function_t type @@ -15872,7 +15872,7 @@ namespace ur::extras { /// - ::UR_RESULT_ERROR_INVALID_ENUMERATION /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER /// - `NULL == params` -UR_APIEXPORT inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { +inline ur_result_t UR_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { if (!params) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } diff --git a/scripts/templates/print.hpp.mako b/scripts/templates/print.hpp.mako index 7c1034089b..f79a6ab87a 100644 --- a/scripts/templates/print.hpp.mako +++ b/scripts/templates/print.hpp.mako @@ -156,9 +156,9 @@ template inline ${x}_result_t printTagged(std::ostream &os, const v %for spec in specs: %for obj in spec['objects']: %if re.match(r"enum", obj['type']): - ${X}_APIEXPORT inline std::ostream &operator<<(std::ostream &os, ${th.make_enum_name(n, tags, obj)} value); + inline std::ostream &operator<<(std::ostream &os, ${th.make_enum_name(n, tags, obj)} value); %elif re.match(r"struct", obj['type']): - ${X}_APIEXPORT inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ${obj['type']} ${th.make_type_name(n, tags, obj)} params); + inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const ${obj['type']} ${th.make_type_name(n, tags, obj)} params); %endif %endfor # obj in spec['objects'] %endfor @@ -443,7 +443,7 @@ namespace ${x}::extras { /// - ::${X}_RESULT_ERROR_INVALID_ENUMERATION /// - ::${X}_RESULT_ERROR_INVALID_NULL_POINTER /// - `NULL == params` -${X}_APIEXPORT inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { +inline ${x}_result_t ${X}_APICALL printFunctionParams(std::ostream &os, ur_function_t function, const void *params) { if (!params) { return ${X}_RESULT_ERROR_INVALID_NULL_POINTER; } From 79457b2e32d71d19cd217f89269a87474cb8085b Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 27 Nov 2023 15:56:44 +0000 Subject: [PATCH 121/145] Make unsupported top level return --- source/adapters/hip/memory.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 0a29e58c27..a6f219d960 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -264,6 +264,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, switch (MemInfoType) { case UR_MEM_INFO_SIZE: { +#if HIP_VERSION < 50600000 + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; +#else try { const auto MemVisitor = [](auto &&Mem) -> size_t { using T = std::decay_t; @@ -274,12 +277,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; -#if HIP_VERSION >= 50600000 UR_CHECK_ERROR( hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); -#else - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -#endif const auto PixelSizeBytes = GetHipFormatPixelSize(ArrayDescriptor.Format) * ArrayDescriptor.NumChannels; @@ -301,6 +300,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } +#endif } case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); From 1c85750f8f34af3437f33bbe1883ce2457df1bc9 Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 27 Nov 2023 16:11:39 +0000 Subject: [PATCH 122/145] Make work for buffer case --- source/adapters/hip/memory.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index a6f219d960..99e9b86a13 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -265,8 +265,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, switch (MemInfoType) { case UR_MEM_INFO_SIZE: { #if HIP_VERSION < 50600000 - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; -#else + if constexpr (std::is_same_v) { + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } +#endif try { const auto MemVisitor = [](auto &&Mem) -> size_t { using T = std::decay_t; @@ -276,6 +278,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, UR_CHECK_ERROR(hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.Ptr)); return AllocSize; } else if constexpr (std::is_same_v) { +#if HIP_VERSION < 50600000 + return 0; +#else HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; UR_CHECK_ERROR( hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); @@ -288,6 +293,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, (ArrayDescriptor.Height ? ArrayDescriptor.Height : 1) * (ArrayDescriptor.Depth ? ArrayDescriptor.Depth : 1); return ImageSizeBytes; +#endif } else { static_assert(ur_always_false_t, "Not exhaustive visitor!"); } @@ -300,7 +306,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, } catch (...) { return UR_RESULT_ERROR_UNKNOWN; } -#endif } case UR_MEM_INFO_CONTEXT: { return ReturnValue(hMemory->getContext()); From f6c476d314bc19ae6987235e814103bad4a5b6bd Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Mon, 27 Nov 2023 12:13:36 -0500 Subject: [PATCH 123/145] Throw from std::visit --- source/adapters/hip/memory.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 99e9b86a13..899dad5674 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -264,11 +264,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, switch (MemInfoType) { case UR_MEM_INFO_SIZE: { -#if HIP_VERSION < 50600000 - if constexpr (std::is_same_v) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; - } -#endif try { const auto MemVisitor = [](auto &&Mem) -> size_t { using T = std::decay_t; @@ -279,7 +274,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, return AllocSize; } else if constexpr (std::is_same_v) { #if HIP_VERSION < 50600000 - return 0; + throw UR_RESULT_ERROR_UNSUPPORTED_FEATURE; #else HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; UR_CHECK_ERROR( From 40c8da9b9ca637afbd887b1e5a3deb7f7581febc Mon Sep 17 00:00:00 2001 From: "Spruit, Neil R" Date: Mon, 2 Oct 2023 08:32:07 -0700 Subject: [PATCH 124/145] [UR][L0] Check Global Mem Size as Limit for Free Memory Signed-off-by: Spruit, Neil R --- source/adapters/level_zero/device.cpp | 35 ++++++++++++++++++--------- source/adapters/level_zero/device.hpp | 5 ++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/source/adapters/level_zero/device.cpp b/source/adapters/level_zero/device.cpp index f5b00d80cc..ec6a294c21 100644 --- a/source/adapters/level_zero/device.cpp +++ b/source/adapters/level_zero/device.cpp @@ -88,6 +88,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGet( return UR_RESULT_SUCCESS; } +uint64_t calculateGlobalMemSize(ur_device_handle_t Device) { + // Cache GlobalMemSize + Device->ZeGlobalMemSize.Compute = + [Device](struct ze_global_memsize &GlobalMemSize) { + for (const auto &ZeDeviceMemoryExtProperty : + Device->ZeDeviceMemoryProperties->second) { + GlobalMemSize.value += ZeDeviceMemoryExtProperty.physicalSize; + } + if (GlobalMemSize.value == 0) { + for (const auto &ZeDeviceMemoryProperty : + Device->ZeDeviceMemoryProperties->first) { + GlobalMemSize.value += ZeDeviceMemoryProperty.totalSize; + } + } + }; + return Device->ZeGlobalMemSize.operator->()->value; +} + UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( ur_device_handle_t Device, ///< [in] handle of the device instance ur_device_info_t ParamName, ///< [in] type of the info to retrieve @@ -251,20 +269,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: return ReturnValue(uint64_t{Device->ZeDeviceProperties->maxMemAllocSize}); case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: { - uint64_t GlobalMemSize = 0; // Support to read physicalSize depends on kernel, // so fallback into reading totalSize if physicalSize // is not available. - for (const auto &ZeDeviceMemoryExtProperty : - Device->ZeDeviceMemoryProperties->second) { - GlobalMemSize += ZeDeviceMemoryExtProperty.physicalSize; - } - if (GlobalMemSize == 0) { - for (const auto &ZeDeviceMemoryProperty : - Device->ZeDeviceMemoryProperties->first) { - GlobalMemSize += ZeDeviceMemoryProperty.totalSize; - } - } + uint64_t GlobalMemSize = calculateGlobalMemSize(Device); return ReturnValue(uint64_t{GlobalMemSize}); } case UR_DEVICE_INFO_LOCAL_MEM_SIZE: @@ -637,6 +645,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( static_cast(ZE_RESULT_ERROR_UNINITIALIZED)); return UR_RESULT_ERROR_ADAPTER_SPECIFIC; } + // Calculate the global memory size as the max limit that can be reported as + // "free" memory for the user to allocate. + uint64_t GlobalMemSize = calculateGlobalMemSize(Device); // Only report device memory which zeMemAllocDevice can allocate from. // Currently this is only the one enumerated with ordinal 0. uint64_t FreeMemory = 0; @@ -661,7 +672,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( } } } - return ReturnValue(FreeMemory); + return ReturnValue(std::min(GlobalMemSize, FreeMemory)); } case UR_DEVICE_INFO_MEMORY_CLOCK_RATE: { // If there are not any memory modules then return 0. diff --git a/source/adapters/level_zero/device.hpp b/source/adapters/level_zero/device.hpp index 35404c6525..bdae64beba 100644 --- a/source/adapters/level_zero/device.hpp +++ b/source/adapters/level_zero/device.hpp @@ -39,6 +39,10 @@ enum EventsScope { LastCommandInBatchHostVisible }; +struct ze_global_memsize { + uint64_t value; +}; + struct ur_device_handle_t_ : _ur_object { ur_device_handle_t_(ze_device_handle_t Device, ur_platform_handle_t Plt, ur_device_handle_t ParentDevice = nullptr) @@ -170,4 +174,5 @@ struct ur_device_handle_t_ : _ur_object { ZeDeviceMemoryAccessProperties; ZeCache> ZeDeviceCacheProperties; ZeCache> ZeDeviceIpVersionExt; + ZeCache ZeGlobalMemSize; }; From 4f8c3d1c19b6c26a33e25c9faeedea9799c3b6d4 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Tue, 28 Nov 2023 13:28:51 +0100 Subject: [PATCH 125/145] Fix adapter registry coverity issues --- source/loader/ur_adapter_registry.hpp | 7 ++++--- test/loader/adapter_registry/search_order.cpp | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/source/loader/ur_adapter_registry.hpp b/source/loader/ur_adapter_registry.hpp index 67ddca9890..3cfac34647 100644 --- a/source/loader/ur_adapter_registry.hpp +++ b/source/loader/ur_adapter_registry.hpp @@ -41,7 +41,8 @@ class AdapterRegistry { } if (exists) { - adaptersLoadPaths.emplace_back(std::vector{path}); + adaptersLoadPaths.emplace_back( + std::vector{std::move(path)}); } else { logger::warning( "Detected nonexistent path {} in environmental " @@ -164,12 +165,12 @@ class AdapterRegistry { auto adapterNamePathOpt = getAdapterNameAsPath(adapterName); if (adapterNamePathOpt.has_value()) { - auto adapterNamePath = adapterNamePathOpt.value(); + const auto &adapterNamePath = adapterNamePathOpt.value(); loadPaths.emplace_back(adapterNamePath); } if (loaderLibPathOpt.has_value()) { - auto loaderLibPath = loaderLibPathOpt.value(); + const auto &loaderLibPath = loaderLibPathOpt.value(); loadPaths.emplace_back(loaderLibPath / adapterName); } diff --git a/test/loader/adapter_registry/search_order.cpp b/test/loader/adapter_registry/search_order.cpp index 9264bafe44..dbb6115467 100644 --- a/test/loader/adapter_registry/search_order.cpp +++ b/test/loader/adapter_registry/search_order.cpp @@ -6,7 +6,7 @@ #include "fixtures.hpp" template -void assertRegistryPathSequence(std::vector testAdapterPaths, +void assertRegistryPathSequence(const std::vector &testAdapterPaths, P predicate) { static size_t assertIndex = 0; @@ -24,7 +24,7 @@ TEST_F(adapterRegSearchTest, testSearchOrder) { auto it = std::find_if(registry.cbegin(), registry.cend(), hasTestLibName); ASSERT_NE(it, registry.end()); - auto testAdapterPaths = *it; + const auto &testAdapterPaths = *it; assertRegistryPathSequence(testAdapterPaths, isTestEnvPath); #ifndef _WIN32 assertRegistryPathSequence(testAdapterPaths, isTestLibName); From 69f29927aaf6fb893f088c20e5cc74d7e6b8a19f Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Tue, 28 Nov 2023 13:29:05 +0100 Subject: [PATCH 126/145] Fix disjoint pool coverity issues --- source/common/umf_pools/disjoint_pool.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/common/umf_pools/disjoint_pool.cpp b/source/common/umf_pools/disjoint_pool.cpp index 7259c977ed..8d7d59a1a6 100644 --- a/source/common/umf_pools/disjoint_pool.cpp +++ b/source/common/umf_pools/disjoint_pool.cpp @@ -913,7 +913,7 @@ void *DisjointPool::malloc(size_t size) { // For full-slab allocations indicates auto Ptr = impl->allocate(size, FromPool); if (impl->getParams().PoolTrace > 2) { - auto MT = impl->getParams().name; + const auto &MT = impl->getParams().name; std::cout << "Allocated " << std::setw(8) << size << " " << MT << " bytes from " << (FromPool ? "Pool" : "Provider") << " ->" << Ptr << std::endl; @@ -938,7 +938,7 @@ void *DisjointPool::aligned_malloc(size_t size, size_t alignment) { auto Ptr = impl->allocate(size, alignment, FromPool); if (impl->getParams().PoolTrace > 2) { - auto MT = impl->getParams().name; + const auto &MT = impl->getParams().name; std::cout << "Allocated " << std::setw(8) << size << " " << MT << " bytes aligned at " << alignment << " from " << (FromPool ? "Pool" : "Provider") << " ->" << Ptr @@ -957,7 +957,7 @@ enum umf_result_t DisjointPool::free(void *ptr) try { impl->deallocate(ptr, ToPool); if (impl->getParams().PoolTrace > 2) { - auto MT = impl->getParams().name; + const auto &MT = impl->getParams().name; std::cout << "Freed " << MT << " " << ptr << " to " << (ToPool ? "Pool" : "Provider") << ", Current total pool size " From b92b60d0efe2c7ec3def2f7222680bd8ad76f94b Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Tue, 28 Nov 2023 13:29:20 +0100 Subject: [PATCH 127/145] Fix pool manager coverity issues --- test/usm/usmPoolManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/usm/usmPoolManager.cpp b/test/usm/usmPoolManager.cpp index fe07d5ebe8..6d2eb33bfe 100644 --- a/test/usm/usmPoolManager.cpp +++ b/test/usm/usmPoolManager.cpp @@ -90,7 +90,7 @@ TEST_P(urUsmPoolManagerTest, poolManagerInsertExisting) { auto [ret, manager] = usm::pool_manager::create(); ASSERT_EQ(ret, UR_RESULT_SUCCESS); - auto desc = poolDescriptors[0]; + const auto &desc = poolDescriptors[0]; auto pool = nullPoolCreate(); ASSERT_NE(pool, nullptr); From 28590a82e9a4b63612f7319760dae4f0d02c9d3b Mon Sep 17 00:00:00 2001 From: Jaime Arteaga Date: Mon, 20 Nov 2023 21:37:17 -0800 Subject: [PATCH 128/145] [UR][L0] Unify use of large allocation in L0 adapter Intel(R) GPUs have two modes of operation in terms of allocations: Stateful and stateless mode. Stateful optimizes memory accesses through pointer arithmetic. This can be done as long as allocations used by the allocation are smaller than 4GB. Stateless disables such pointer-arithmetic optimization to allow the kernel to use allocations larger than 4GB. Currently, L0 adapter dynamically and automatically requests the L0 driver large allocations if it detects an allocation size is larger than 4GB. This creates a problem if a kernel has been previously compiled for stateful access. This ultimately means the adapter mixes stateful and stateless behavior, which is not a user-friendly experience. This patch aims at correcting this behavior by defining a default one. On Intel(R) GPUs previous to Intel(R) Data Center GPU Max, default behavior is now stateless, meaning all allocations are only allowed by default. Users can opt-in for stateful mode setting a new environment variable UR_L0_USE_OPTIMIZED_32BIT_ACCESS=1. Addresses: https://stackoverflow.com/questions/75621264/sycl-dot-product-code-gives-wrong-results Signed-off-by: Jaime Arteaga --- source/adapters/level_zero/device.cpp | 24 +++++++++++++++++++++- source/adapters/level_zero/device.hpp | 16 +++++++++++++++ source/adapters/level_zero/program.cpp | 28 ++++++++++++++++++++++++-- source/adapters/level_zero/usm.cpp | 8 +++++--- 4 files changed, 70 insertions(+), 6 deletions(-) diff --git a/source/adapters/level_zero/device.cpp b/source/adapters/level_zero/device.cpp index ec6a294c21..acc7c755f4 100644 --- a/source/adapters/level_zero/device.cpp +++ b/source/adapters/level_zero/device.cpp @@ -267,7 +267,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo( return ReturnValue(uint32_t{64}); } case UR_DEVICE_INFO_MAX_MEM_ALLOC_SIZE: - return ReturnValue(uint64_t{Device->ZeDeviceProperties->maxMemAllocSize}); + // if not optimized for 32-bit access, return total memory size. + // otherwise, return only maximum allocatable size. + if (Device->useOptimized32bitAccess() == 0) { + return ReturnValue(uint64_t{calculateGlobalMemSize(Device)}); + } else { + return ReturnValue(uint64_t{Device->ZeDeviceProperties->maxMemAllocSize}); + } case UR_DEVICE_INFO_GLOBAL_MEM_SIZE: { // Support to read physicalSize depends on kernel, // so fallback into reading totalSize if physicalSize @@ -911,6 +917,22 @@ ur_device_handle_t_::useImmediateCommandLists() { } } +int32_t ur_device_handle_t_::useOptimized32bitAccess() { + static const int32_t Optimize32bitAccessMode = [this] { + // If device is Intel(R) Data Center GPU Max, + // use default provided by L0 driver. + // TODO: Use IP versioning to select based on range of devices + if (this->isPVC()) + return -1; + const char *UrRet = std::getenv("UR_L0_USE_OPTIMIZED_32BIT_ACCESS"); + if (!UrRet) + return 0; + return std::atoi(UrRet); + }(); + + return Optimize32bitAccessMode; +} + ur_result_t ur_device_handle_t_::initialize(int SubSubDeviceOrdinal, int SubSubDeviceIndex) { // Maintain various device properties cache. diff --git a/source/adapters/level_zero/device.hpp b/source/adapters/level_zero/device.hpp index bdae64beba..5f34efab44 100644 --- a/source/adapters/level_zero/device.hpp +++ b/source/adapters/level_zero/device.hpp @@ -145,6 +145,22 @@ struct ur_device_handle_t_ : _ur_object { // Returns whether immediate command lists are used on this device. ImmCmdlistMode ImmCommandListUsed{}; + // Returns whether large allocations are being used + // or not to have a consistent behavior throughout + // the adapter between the creation of large allocations + // and the compilation of kernels into stateful and + // stateless modes. + // With stateful mode, kernels are compiled with + // pointer-arithmetic optimizations for optimized + // access of allocations smaller than 4GB. + // In stateless mode, such optimizations are not + // applied. + // Even if a GPU supports both modes, L0 driver may + // provide support for only one, like for Intel(R) + // Data Center GPU Max, for which L0 driver only + // supports stateless. + int32_t useOptimized32bitAccess(); + bool isSubDevice() { return RootDevice != nullptr; } // Is this a Data Center GPU Max series (aka PVC)? diff --git a/source/adapters/level_zero/program.cpp b/source/adapters/level_zero/program.cpp index 92a3c87aea..f118a5b9dd 100644 --- a/source/adapters/level_zero/program.cpp +++ b/source/adapters/level_zero/program.cpp @@ -148,9 +148,24 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuildExp( ZeModuleDesc.format = (hProgram->State == ur_program_handle_t_::IL) ? ZE_MODULE_FORMAT_IL_SPIRV : ZE_MODULE_FORMAT_NATIVE; + ZeModuleDesc.inputSize = hProgram->CodeLength; ZeModuleDesc.pInputModule = hProgram->Code.get(); - ZeModuleDesc.pBuildFlags = pOptions; + + // if large allocations are selected, then pass + // ze-opt-greater-than-4GB-buffer-required to disable + // stateful optimizations and be able to use larger than + // 4GB allocations on these kernels. + std::string ZeBuildOptions{}; + if (pOptions) { + ZeBuildOptions += pOptions; + } + + if (phDevices[0]->useOptimized32bitAccess() == 0) { + ZeBuildOptions += " -ze-opt-greater-than-4GB-buffer-required"; + } + + ZeModuleDesc.pBuildFlags = ZeBuildOptions.c_str(); ZeModuleDesc.pConstants = Shim.ze(); ze_device_handle_t ZeDevice = phDevices[0]->ZeDevice; @@ -234,8 +249,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCompile( // This produces better code because the driver can do cross-module // optimizations. Therefore, we just remember the compilation flags, so we // can use them later. - if (Options) + if (Options) { Program->BuildFlags = Options; + + // if large allocations are selected, then pass + // ze-opt-greater-than-4GB-buffer-required to disable + // stateful optimizations and be able to use larger than + // 4GB allocations on these kernels. + if (Context->Devices[0]->useOptimized32bitAccess() == 0) { + Program->BuildFlags += " -ze-opt-greater-than-4GB-buffer-required"; + } + } Program->State = ur_program_handle_t_::Object; return UR_RESULT_SUCCESS; diff --git a/source/adapters/level_zero/usm.cpp b/source/adapters/level_zero/usm.cpp index daec0408fb..c6d98855e7 100644 --- a/source/adapters/level_zero/usm.cpp +++ b/source/adapters/level_zero/usm.cpp @@ -178,9 +178,11 @@ static ur_result_t USMDeviceAllocImpl(void **ResultPtr, ZeDesc.flags = 0; ZeDesc.ordinal = 0; - ZeStruct RelaxedDesc; - if (Size > Device->ZeDeviceProperties->maxMemAllocSize) { - // Tell Level-Zero to accept Size > maxMemAllocSize + if (Device->useOptimized32bitAccess() == 0 && + (Size > Device->ZeDeviceProperties->maxMemAllocSize)) { + // Tell Level-Zero to accept Size > maxMemAllocSize if + // large allocations are used. + ZeStruct RelaxedDesc; RelaxedDesc.flags = ZE_RELAXED_ALLOCATION_LIMITS_EXP_FLAG_MAX_SIZE; ZeDesc.pNext = &RelaxedDesc; } From e770fddc4d61a001ca4b3e99555f8c8592e143b3 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 30 Nov 2023 10:59:05 +0000 Subject: [PATCH 129/145] [GHA] Disable Windows L0 clang-cl job --- .github/workflows/cmake.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 665f30b9a9..cb0f92ad17 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -283,10 +283,13 @@ jobs: {name: None, var: ''}, {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} ] - # TODO: building level zero loader on windows-2019 is currently broken + # TODO: building level zero loader on windows-2019 and clang-cl.exe is currently broken exclude: - os: 'windows-2019' adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} + - adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'} + compiler: {c: clang-cl.exe, cxx: clang-cl.exe} + build_type: [Debug, Release] compiler: [{c: cl.exe, cxx: cl.exe}, {c: clang-cl.exe, cxx: clang-cl.exe}] runs-on: ${{matrix.os}} From a92a989a0c01eeb7c40f632355c945b380b32ef6 Mon Sep 17 00:00:00 2001 From: omarahmed1111 Date: Thu, 30 Nov 2023 11:49:58 +0000 Subject: [PATCH 130/145] Fix opencl ctest match files --- source/adapters/opencl/command_buffer.cpp | 25 +++++++++++++++ ...ncl.match => adapter_adapter_opencl.match} | 0 .../context/context_adapter_opencl.match | 1 - .../device/device_adapter_cuda.match | 1 + .../device/device_adapter_level_zero.match | 1 + .../device/device_adapter_opencl.match | 2 -- .../enqueue/enqueue_adapter_opencl.match | 32 ++++++++++++++++++- .../event/event_adapter_opencl.match | 2 -- .../kernel/kernel_adapter_opencl.match | 10 +++++- .../memory/memory_adapter_opencl.match | 4 --- .../platform/platform_adapter_opencl.match | 1 - .../program/program_adapter_opencl.match | 22 +------------ .../queue/queue_adapter_opencl.match | 4 +-- .../virtual_memory_adapter_opencl.match | 15 --------- tools/urtrace/collector.cpp | 2 +- 15 files changed, 70 insertions(+), 52 deletions(-) rename test/conformance/adapter/{runtime_adapter_opencl.match => adapter_adapter_opencl.match} (100%) diff --git a/source/adapters/opencl/command_buffer.cpp b/source/adapters/opencl/command_buffer.cpp index a99fd676ff..56b4d16b88 100644 --- a/source/adapters/opencl/command_buffer.cpp +++ b/source/adapters/opencl/command_buffer.cpp @@ -147,6 +147,31 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendUSMFillExp( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } +UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyExp( + ur_exp_command_buffer_handle_t hCommandBuffer, ur_mem_handle_t hSrcMem, + ur_mem_handle_t hDstMem, size_t srcOffset, size_t dstOffset, size_t size, + uint32_t numSyncPointsInWaitList, + const ur_exp_command_buffer_sync_point_t *pSyncPointWaitList, + ur_exp_command_buffer_sync_point_t *pSyncPoint) { + + cl_context CLContext = cl_adapter::cast(hCommandBuffer->hContext); + cl_ext::clCommandCopyBufferKHR_fn clCommandCopyBufferKHR = nullptr; + cl_int Res = cl_ext::getExtFuncFromContext( + CLContext, cl_ext::ExtFuncPtrCache->clCommandCopyBufferKHRCache, + cl_ext::CommandCopyBufferName, &clCommandCopyBufferKHR); + + if (!clCommandCopyBufferKHR || Res != CL_SUCCESS) + return UR_RESULT_ERROR_INVALID_OPERATION; + + CL_RETURN_ON_FAILURE(clCommandCopyBufferKHR( + hCommandBuffer->CLCommandBuffer, nullptr, + cl_adapter::cast(hSrcMem), cl_adapter::cast(hDstMem), + srcOffset, dstOffset, size, numSyncPointsInWaitList, pSyncPointWaitList, + pSyncPoint, nullptr)); + + return UR_RESULT_SUCCESS; +} + UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferAppendMemBufferCopyRectExp( [[maybe_unused]] ur_exp_command_buffer_handle_t hCommandBuffer, [[maybe_unused]] ur_mem_handle_t hSrcMem, diff --git a/test/conformance/adapter/runtime_adapter_opencl.match b/test/conformance/adapter/adapter_adapter_opencl.match similarity index 100% rename from test/conformance/adapter/runtime_adapter_opencl.match rename to test/conformance/adapter/adapter_adapter_opencl.match diff --git a/test/conformance/context/context_adapter_opencl.match b/test/conformance/context/context_adapter_opencl.match index 0f0e82d7d9..e69de29bb2 100644 --- a/test/conformance/context/context_adapter_opencl.match +++ b/test/conformance/context/context_adapter_opencl.match @@ -1 +0,0 @@ -urContextCreateWithNativeHandleTest.Success/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/device/device_adapter_cuda.match b/test/conformance/device/device_adapter_cuda.match index e69de29bb2..48e00debe4 100644 --- a/test/conformance/device/device_adapter_cuda.match +++ b/test/conformance/device/device_adapter_cuda.match @@ -0,0 +1 @@ +{{OPT}}urDeviceGetGlobalTimestampTest.SuccessSynchronizedTime diff --git a/test/conformance/device/device_adapter_level_zero.match b/test/conformance/device/device_adapter_level_zero.match index 51f9f62269..9711e9152b 100644 --- a/test/conformance/device/device_adapter_level_zero.match +++ b/test/conformance/device/device_adapter_level_zero.match @@ -1,3 +1,4 @@ +{{OPT}}urDeviceGetGlobalTimestampTest.SuccessSynchronizedTime urDeviceGetInfoTest.Success/UR_DEVICE_INFO_IMAGE_SUPPORTED urDeviceGetInfoTest.Success/UR_DEVICE_INFO_GLOBAL_MEM_FREE urDeviceGetInfoTest.Success/UR_DEVICE_INFO_ERROR_CORRECTION_SUPPORT diff --git a/test/conformance/device/device_adapter_opencl.match b/test/conformance/device/device_adapter_opencl.match index b46c34d6ca..716ebd54fe 100644 --- a/test/conformance/device/device_adapter_opencl.match +++ b/test/conformance/device/device_adapter_opencl.match @@ -1,3 +1 @@ -urDeviceGetTest.InvalidValueNumEntries urDeviceGetInfoTest.Success/UR_DEVICE_INFO_HALF_FP_CONFIG -urDeviceGetInfoTest.Success/UR_DEVICE_INFO_PARTITION_TYPE diff --git a/test/conformance/enqueue/enqueue_adapter_opencl.match b/test/conformance/enqueue/enqueue_adapter_opencl.match index 58bfd87643..54a5ee3762 100644 --- a/test/conformance/enqueue/enqueue_adapter_opencl.match +++ b/test/conformance/enqueue/enqueue_adapter_opencl.match @@ -2,4 +2,34 @@ {{OPT}}urEnqueueMemBufferCopyRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ {{OPT}}urEnqueueMemBufferReadRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ {{OPT}}urEnqueueMemBufferWriteRectTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ -{{OPT}}Segmentation fault +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DTestWithParam.Success/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMFill2DNegativeTest.OutOfBounds/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMAdviseTest.InvalidSizeTooLarge/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessNonBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessNonBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessNonBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessNonBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessNonBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DTestWithParam.SuccessNonBlocking/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DNegativeTest.InvalidNullHandleQueue/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DNegativeTest.InvalidNullPointer/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DNegativeTest.InvalidSize/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMMemcpy2DNegativeTest.InvalidEventWaitList/Intel_R__OpenCL___{{.*}}_ +{{OPT}}urEnqueueUSMPrefetchTest.InvalidSizeTooLarge/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/event/event_adapter_opencl.match b/test/conformance/event/event_adapter_opencl.match index 43bd5fe2ed..e69de29bb2 100644 --- a/test/conformance/event/event_adapter_opencl.match +++ b/test/conformance/event/event_adapter_opencl.match @@ -1,2 +0,0 @@ -urEventSetCallbackTest.AllStates/Intel_R__OpenCL___{{.*}}_ -urEventSetCallbackNegativeTest.InvalidNullHandle/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/kernel/kernel_adapter_opencl.match b/test/conformance/kernel/kernel_adapter_opencl.match index 7a1c0d5b8e..9a890011d8 100644 --- a/test/conformance/kernel/kernel_adapter_opencl.match +++ b/test/conformance/kernel/kernel_adapter_opencl.match @@ -1 +1,9 @@ -Segmentation fault +urKernelSetArgSamplerTest.Success/Intel_R__OpenCL___{{.*}}_ +urKernelSetArgSamplerTest.InvalidNullHandleKernel/Intel_R__OpenCL___{{.*}}_ +urKernelSetArgSamplerTest.InvalidNullHandleArgValue/Intel_R__OpenCL___{{.*}}_ +urKernelSetArgSamplerTest.InvalidKernelArgumentIndex/Intel_R__OpenCL___{{.*}}_ +urKernelSetArgValueTest.InvalidKernelArgumentSize/Intel_R__OpenCL___{{.*}}_ +urKernelSetSpecializationConstantsTest.Success/Intel_R__OpenCL___{{.*}}_ +urKernelSetSpecializationConstantsTest.InvalidNullHandleKernel/Intel_R__OpenCL___{{.*}}_ +urKernelSetSpecializationConstantsTest.InvalidNullPointerSpecConstants/Intel_R__OpenCL___{{.*}}_ +urKernelSetSpecializationConstantsTest.InvalidSizeCount/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/memory/memory_adapter_opencl.match b/test/conformance/memory/memory_adapter_opencl.match index f6df605fa6..c01e55d804 100644 --- a/test/conformance/memory/memory_adapter_opencl.match +++ b/test/conformance/memory/memory_adapter_opencl.match @@ -1,5 +1 @@ -urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerParamValue/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_CONTEXT -urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_SIZE -urMemGetInfoTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}___UR_MEM_INFO_CONTEXT urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/platform/platform_adapter_opencl.match b/test/conformance/platform/platform_adapter_opencl.match index df63fbef05..e69de29bb2 100644 --- a/test/conformance/platform/platform_adapter_opencl.match +++ b/test/conformance/platform/platform_adapter_opencl.match @@ -1 +0,0 @@ -urPlatformGetTest.InvalidNumEntries diff --git a/test/conformance/program/program_adapter_opencl.match b/test/conformance/program/program_adapter_opencl.match index 1354f1f211..716bf27d9d 100644 --- a/test/conformance/program/program_adapter_opencl.match +++ b/test/conformance/program/program_adapter_opencl.match @@ -5,26 +5,6 @@ urProgramCreateWithBinaryTest.InvalidNullPointerBinary/Intel_R__OpenCL___{{.*}}_ urProgramCreateWithBinaryTest.InvalidNullPointerProgram/Intel_R__OpenCL___{{.*}}_ urProgramCreateWithBinaryTest.InvalidNullPointerMetadata/Intel_R__OpenCL___{{.*}}_ urProgramCreateWithBinaryTest.InvalidSizePropertyCount/Intel_R__OpenCL___{{.*}}_ -urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ -urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/Intel_R__OpenCL___{{.*}}_ -urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS -urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_OPTIONS -urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_LOG -urProgramGetBuildInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE -urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_STATUS -urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_OPTIONS -urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_LOG -urProgramGetBuildInfoTest.InvalidNullHandleDevice/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE urProgramGetFunctionPointerTest.InvalidFunctionName/Intel_R__OpenCL___{{.*}}_ urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE -urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS -urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_REFERENCE_COUNT -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_CONTEXT -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_DEVICES -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_DEVICES -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_SOURCE -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARY_SIZES -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARIES -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_NUM_KERNELS -urProgramGetInfoTest.InvalidNullHandleProgram/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_KERNEL_NAMES +urProgramGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_PROGRAM_INFO_BINARIES diff --git a/test/conformance/queue/queue_adapter_opencl.match b/test/conformance/queue/queue_adapter_opencl.match index 59c11b7c86..a374e0b4b1 100644 --- a/test/conformance/queue/queue_adapter_opencl.match +++ b/test/conformance/queue/queue_adapter_opencl.match @@ -1,4 +1,2 @@ -urQueueCreateTest.InvalidQueueProperties/Intel_R__OpenCL___{{.*}}_ -urQueueCreateWithNativeHandleTest.Success/Intel_R__OpenCL___{{.*}}_ +urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_DEVICE_DEFAULT urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_SIZE -urQueueGetInfoTestWithInfoParam.Success/Intel_R__OpenCL___{{.*}}___UR_QUEUE_INFO_EMPTY diff --git a/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match b/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match index bf82e6fb92..e69de29bb2 100644 --- a/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match +++ b/test/conformance/virtual_memory/virtual_memory_adapter_opencl.match @@ -1,15 +0,0 @@ -urVirtualMemGetInfoTestWithParam.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_INFO_ACCESS_MODE -urVirtualMemGetInfoTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGetInfoTest.InvalidNullPointerStart/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGetInfoTest.InvalidEnumerationInfo/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGranularityGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_GRANULARITY_INFO_MINIMUM -urVirtualMemGranularityGetInfoTest.Success/Intel_R__OpenCL___{{.*}}___UR_VIRTUAL_MEM_GRANULARITY_INFO_RECOMMENDED -urVirtualMemGranularityGetInfoNegativeTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGranularityGetInfoNegativeTest.InvalidEnumeration/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGranularityGetInfoNegativeTest.InvalidNullPointerPropSizeRet/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGranularityGetInfoNegativeTest.InvalidNullPointerPropValue/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGranularityGetInfoNegativeTest.InvalidPropSizeZero/Intel_R__OpenCL___{{.*}}_ -urVirtualMemGranularityGetInfoNegativeTest.InvalidSizePropSizeSmall/Intel_R__OpenCL___{{.*}}_ -urVirtualMemSetAccessTest.Success/Intel_R__OpenCL___{{.*}}_ -urVirtualMemSetAccessTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}_ -urVirtualMemSetAccessTest.InvalidNullPointerStart/Intel_R__OpenCL___{{.*}}_ diff --git a/tools/urtrace/collector.cpp b/tools/urtrace/collector.cpp index 8c7770ba57..a78cb82d08 100644 --- a/tools/urtrace/collector.cpp +++ b/tools/urtrace/collector.cpp @@ -331,7 +331,7 @@ XPTI_CALLBACK_API void trace_cb(uint16_t trace_type, xpti::trace_event_data_t *, if (cli_args.no_args) { args_str << "..."; } else { - extras::printFunctionParams( + ur::extras::printFunctionParams( args_str, (enum ur_function_t)args->function_id, args->args_data); } From 4cffc1d481697a593bf1a10f15a922f2c3476f8c Mon Sep 17 00:00:00 2001 From: Martin Morrison-Grant Date: Mon, 27 Nov 2023 13:07:20 +0000 Subject: [PATCH 131/145] Added new CMake flag UR_BUILD_ADAPTER_ALL to build all supported adapters. --- CMakeLists.txt | 11 ++++++----- README.md | 13 +++++++------ source/adapters/CMakeLists.txt | 10 +++++----- test/adapters/CMakeLists.txt | 4 ++-- test/conformance/CMakeLists.txt | 12 ++++++------ test/fuzz/CMakeLists.txt | 2 +- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16a96afb72..83275bf812 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,11 +35,12 @@ option(UR_USE_TSAN "enable ThreadSanitizer" OFF) option(UR_ENABLE_TRACING "enable api tracing through xpti" OFF) option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF) option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" OFF) -option(UR_BUILD_ADAPTER_L0 "build level 0 adapter from SYCL" OFF) -option(UR_BUILD_ADAPTER_OPENCL "build opencl adapter from SYCL" OFF) -option(UR_BUILD_ADAPTER_CUDA "build cuda adapter from SYCL" OFF) -option(UR_BUILD_ADAPTER_HIP "build hip adapter from SYCL" OFF) -option(UR_BUILD_ADAPTER_NATIVE_CPU "build native_cpu adapter from SYCL" OFF) +option(UR_BUILD_ADAPTER_L0 "Build the Level-Zero adapter" OFF) +option(UR_BUILD_ADAPTER_OPENCL "Build the OpenCL adapter" OFF) +option(UR_BUILD_ADAPTER_CUDA "Build the CUDA adapter" OFF) +option(UR_BUILD_ADAPTER_HIP "Build the HIP adapter" OFF) +option(UR_BUILD_ADAPTER_NATIVE_CPU "Build the Native-CPU adapter" OFF) +option(UR_BUILD_ADAPTER_ALL "Build all currently supported adapters" OFF) option(UR_BUILD_EXAMPLE_CODEGEN "Build the codegen example." OFF) option(VAL_USE_LIBBACKTRACE_BACKTRACE "enable libbacktrace validation backtrace for linux" OFF) set(UR_DPCXX "" CACHE FILEPATH "Path of the DPC++ compiler executable") diff --git a/README.md b/README.md index 56ef7afb52..f62e36e38d 100644 --- a/README.md +++ b/README.md @@ -127,12 +127,13 @@ List of options provided by CMake: | UR_USE_MSAN | Enable MemorySanitizer (clang only) | ON/OFF | OFF | | UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF | | UR_CONFORMANCE_TARGET_TRIPLES | SYCL triples to build CTS device binaries for | Comma-separated list | spir64 | -| UR_BUILD_ADAPTER_L0 | Fetch and use level-zero adapter from SYCL | ON/OFF | OFF | -| UR_BUILD_ADAPTER_OPENCL | Fetch and use opencl adapter from SYCL | ON/OFF | OFF | -| UR_BUILD_ADAPTER_CUDA | Fetch and use cuda adapter from SYCL | ON/OFF | OFF | -| UR_BUILD_ADAPTER_HIP | Fetch and use hip adapter from SYCL | ON/OFF | OFF | -| UR_BUILD_ADAPTER_NATIVE_CPU | Fetch and use native-cpu adapter from SYCL | ON/OFF | OFF | -| UR_HIP_PLATFORM | Build hip adapter for AMD or NVIDIA platform | AMD/NVIDIA | AMD | +| UR_BUILD_ADAPTER_L0 | Build the Level-Zero adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_OPENCL | Build the OpenCL adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_CUDA | Build the CUDA adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_HIP | Build the HIP adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_NATIVE_CPU | Build the Native-CPU adapter | ON/OFF | OFF | +| UR_BUILD_ADAPTER_ALL | Build all currently supported adapters | ON/OFF | OFF | +| UR_HIP_PLATFORM | Build HIP adapter for AMD or NVIDIA platform | AMD/NVIDIA | AMD | | UR_ENABLE_COMGR | Enable comgr lib usage | AMD/NVIDIA | AMD | | UR_DPCXX | Path of the DPC++ compiler executable to build CTS device binaries | File path | `""` | | UR_SYCL_LIBRARY_DIR | Path of the SYCL runtime library directory to build CTS device binaries | Directory path | `""` | diff --git a/source/adapters/CMakeLists.txt b/source/adapters/CMakeLists.txt index 3d7700da4a..23e42232de 100644 --- a/source/adapters/CMakeLists.txt +++ b/source/adapters/CMakeLists.txt @@ -32,21 +32,21 @@ add_subdirectory(null) set(INTEL_LLVM_TAG nightly-2023-09-20) -if(UR_BUILD_ADAPTER_L0) +if(UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_ALL) add_subdirectory(level_zero) endif() -if(UR_BUILD_ADAPTER_CUDA) +if(UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_ALL) add_subdirectory(cuda) endif() -if(UR_BUILD_ADAPTER_HIP) +if(UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_ALL) add_subdirectory(hip) endif() -if(UR_BUILD_ADAPTER_OPENCL) +if(UR_BUILD_ADAPTER_OPENCL OR UR_BUILD_ADAPTER_ALL) add_subdirectory(opencl) endif() -if(UR_BUILD_ADAPTER_NATIVE_CPU) +if(UR_BUILD_ADAPTER_NATIVE_CPU OR UR_BUILD_ADAPTER_ALL) add_subdirectory(native_cpu) endif() diff --git a/test/adapters/CMakeLists.txt b/test/adapters/CMakeLists.txt index d87d774ede..3191178606 100644 --- a/test/adapters/CMakeLists.txt +++ b/test/adapters/CMakeLists.txt @@ -37,10 +37,10 @@ function(add_adapter_test name) ENVIRONMENT "${args_ENVIRONMENT}") endfunction() -if(UR_BUILD_ADAPTER_CUDA) +if(UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_ALL) add_subdirectory(cuda) endif() -if(UR_BUILD_ADAPTER_HIP) +if(UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_ALL) add_subdirectory(hip) endif() diff --git a/test/conformance/CMakeLists.txt b/test/conformance/CMakeLists.txt index 5a898846ec..c17dc8564b 100644 --- a/test/conformance/CMakeLists.txt +++ b/test/conformance/CMakeLists.txt @@ -39,25 +39,25 @@ function(add_conformance_test name) ${PROJECT_NAME}::common GTest::gtest_main) - if(UR_BUILD_ADAPTER_CUDA) + if(UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_ALL) add_test_adapter(${name} adapter_cuda) endif() - if(UR_BUILD_ADAPTER_HIP) + if(UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_ALL) add_test_adapter(${name} adapter_hip) endif() - if(UR_BUILD_ADAPTER_L0) + if(UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_ALL) add_test_adapter(${name} adapter_level_zero) endif() - if(UR_BUILD_ADAPTER_OPENCL) + if(UR_BUILD_ADAPTER_OPENCL OR UR_BUILD_ADAPTER_ALL) add_test_adapter(${name} adapter_opencl) endif() - if(UR_BUILD_ADAPTER_NATIVE_CPU) + if(UR_BUILD_ADAPTER_NATIVE_CPU OR UR_BUILD_ADAPTER_ALL) add_test_adapter(${name} adapter_native_cpu) endif() if(NOT (UR_BUILD_ADAPTER_CUDA OR UR_BUILD_ADAPTER_HIP OR UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_OPENCL - OR UR_BUILD_ADAPTER_NATIVE_CPU)) + OR UR_BUILD_ADAPTER_NATIVE_CPU OR UR_BUILD_ADAPTER_ALL)) add_test_adapter(${name} adapter_null) endif() endfunction() diff --git a/test/fuzz/CMakeLists.txt b/test/fuzz/CMakeLists.txt index 97ad1c91c9..897075c53d 100644 --- a/test/fuzz/CMakeLists.txt +++ b/test/fuzz/CMakeLists.txt @@ -18,7 +18,7 @@ function(add_fuzz_test name label) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(ENV_VARS UR_ENABLE_LAYERS=UR_LAYER_FULL_VALIDATION) - if(UR_BUILD_ADAPTER_L0) + if(UR_BUILD_ADAPTER_L0 OR UR_BUILD_ADAPTER_ALL) list(APPEND ENV_VARS UR_ADAPTERS_FORCE_LOAD=\"$\" NEOReadDebugKeys=1 From 681e607ebfe4809ef332231e21dbe64dc92189dd Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 8 Nov 2023 09:32:18 +0100 Subject: [PATCH 132/145] Add system info in CI workflows run on self-hosted runners fixes #1002 --- .github/scripts/get_system_info.sh | 87 ++++++++++++++++++++++++++++++ .github/workflows/cmake.yml | 8 +++ 2 files changed, 95 insertions(+) create mode 100755 .github/scripts/get_system_info.sh diff --git a/.github/scripts/get_system_info.sh b/.github/scripts/get_system_info.sh new file mode 100755 index 0000000000..6ca38a33ef --- /dev/null +++ b/.github/scripts/get_system_info.sh @@ -0,0 +1,87 @@ +#!/usr/bin/env bash + +# Copyright (C) 2023 Intel Corporation +# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions. +# See LICENSE.TXT +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +# get_system_info.sh - Script for printing system info + +function check_L0_version { + if command -v dpkg &> /dev/null; then + dpkg -l | grep level-zero && return + fi + + if command -v rpm &> /dev/null; then + rpm -qa | grep level-zero && return + fi + + if command -v zypper &> /dev/null; then + zypper se level-zero && return + fi + + echo "level-zero not installed" +} + +function system_info { + echo "**********system_info**********" + cat /etc/os-release | grep -oP "PRETTY_NAME=\K.*" + cat /proc/version + echo "**********SYCL-LS**********" + source /opt/intel/oneapi/setvars.sh + sycl-ls + echo "**********VGA**********" + lspci | grep VGA + echo "**********CUDA Version**********" + if command -v nvidia-smi &> /dev/null; then + nvidia-smi + else + echo "CUDA not installed" + fi + echo "**********L0 Version**********" + check_L0_version + echo "**********ROCm Version**********" + if command -v rocminfo &> /dev/null; then + rocminfo + else + echo "ROCm not installed" + fi + echo "**********/proc/cmdline**********" + cat /proc/cmdline + echo "**********CPU info**********" + lscpu + echo "**********/proc/meminfo**********" + cat /proc/meminfo + echo "**********build/bin/urinfo**********" + $(dirname "$(readlink -f "$0")")/../../build/bin/urinfo || true + echo "******OpenCL*******" + # The driver version of OpenCL Graphics is the compute-runtime version + clinfo || echo "OpenCL not installed" + echo "**********list-environment**********" + echo "PATH=$PATH" + echo + echo "CPATH=$CPATH" + echo + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" + echo + echo "LIBRARY_PATH=$LIBRARY_PATH" + echo + echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" + echo + echo "******list-build-system-versions*******" + gcc --version 2>/dev/null || true + echo + clang --version 2>/dev/null || true + echo + make --version 2>/dev/null || true + echo "**********/proc/modules**********" + cat /proc/modules + echo "***************installed-packages***************" + # Instructions below will return some minor errors, as they are dependent on the Linux distribution. + zypper se --installed-only 2>/dev/null || true + apt list --installed 2>/dev/null || true + yum list installed 2>/dev/null || true +} + +# Call the function above to print system info. +system_info diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 780f142f33..bf20594f9b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -221,6 +221,10 @@ jobs: working-directory: ${{github.workspace}}/build run: ctest -C ${{matrix.build_type}} --output-on-failure -L "conformance" --timeout 180 + - name: Get information about platform + if: ${{ always() }} + run: .github/scripts/get_system_info.sh + examples-build-hw: name: Build - examples on HW if: github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks won't have the HW @@ -273,6 +277,10 @@ jobs: cat ${HOME}/.profile || true rm ${HOME}/.profile || true + - name: Get information about platform + if: ${{ always() }} + run: .github/scripts/get_system_info.sh + windows-build: name: Build - Windows strategy: From 5d304c5bcbff2d7fdf37d2015b848ea7e24ed4f8 Mon Sep 17 00:00:00 2001 From: Martin Wehking Date: Mon, 23 Oct 2023 11:32:25 -0400 Subject: [PATCH 133/145] Enable fp16 runtime support for hip --- source/adapters/hip/device.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/adapters/hip/device.cpp b/source/adapters/hip/device.cpp index 5b473c050e..139906e95a 100644 --- a/source/adapters/hip/device.cpp +++ b/source/adapters/hip/device.cpp @@ -549,6 +549,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, SupportedExtensions += "cl_khr_fp64 "; } + SupportedExtensions += "cl_khr_fp16 "; + return ReturnValue(SupportedExtensions.c_str()); } case UR_DEVICE_INFO_PRINTF_BUFFER_SIZE: { From a3bf1686e70351e6e9a4895d479a33dcb2eb5bf1 Mon Sep 17 00:00:00 2001 From: Krzysztof Swiecicki Date: Thu, 2 Nov 2023 11:31:27 +0100 Subject: [PATCH 134/145] [UR] Fix adapter refcount tracking --- scripts/templates/valddi.cpp.mako | 2 +- source/loader/layers/validation/ur_valddi.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/templates/valddi.cpp.mako b/scripts/templates/valddi.cpp.mako index f3ec24bfb9..2e9bac3200 100644 --- a/scripts/templates/valddi.cpp.mako +++ b/scripts/templates/valddi.cpp.mako @@ -82,7 +82,7 @@ namespace ur_validation_layer %elif func_name == n + "AdapterRetain": if( context.enableLeakChecking && result == UR_RESULT_SUCCESS ) { - refCountContext.decrementRefCount(${object_param}, true); + refCountContext.incrementRefCount(${object_param}, true); } %elif func_name == n + "AdapterGet": if( context.enableLeakChecking && phAdapters && result == UR_RESULT_SUCCESS ) diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index a307bb37de..ec0df692cf 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -94,7 +94,7 @@ __urdlllocal ur_result_t UR_APICALL urAdapterRetain( ur_result_t result = pfnAdapterRetain(hAdapter); if (context.enableLeakChecking && result == UR_RESULT_SUCCESS) { - refCountContext.decrementRefCount(hAdapter, true); + refCountContext.incrementRefCount(hAdapter, true); } return result; From 53f3383118af9fc60ab91f44a9f384813b9a81ab Mon Sep 17 00:00:00 2001 From: Callum Fare Date: Mon, 4 Dec 2023 11:27:54 +0000 Subject: [PATCH 135/145] [OpenCL] Fix UR_ADAPTER_INFO_BACKEND value --- source/adapters/opencl/adapter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/adapters/opencl/adapter.cpp b/source/adapters/opencl/adapter.cpp index f1d710ebb4..8ae1e77755 100644 --- a/source/adapters/opencl/adapter.cpp +++ b/source/adapters/opencl/adapter.cpp @@ -66,7 +66,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urAdapterGetInfo(ur_adapter_handle_t, switch (propName) { case UR_ADAPTER_INFO_BACKEND: - return ReturnValue(UR_ADAPTER_BACKEND_CUDA); + return ReturnValue(UR_ADAPTER_BACKEND_OPENCL); case UR_ADAPTER_INFO_REFERENCE_COUNT: return ReturnValue(adapter.RefCount.load()); default: From 512b15888faf74620f5161c66e91d51218b918ee Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Fri, 1 Dec 2023 17:40:34 +0000 Subject: [PATCH 136/145] Allow fixtures derived from KernelTest to defer compilation. Separating the device code compilation from the rest of the setup lets a test query device or platform properties to decide whether it should skip without potentially hitting a compilation error because the kernel being built as part of the setup uses an unsupported feature. --- .../kernel/kernel_adapter_level_zero.match | 12 +++++- .../kernel/kernel_adapter_opencl.match | 4 -- .../kernel/urKernelSetArgPointer.cpp | 2 +- .../kernel/urKernelSetArgSampler.cpp | 10 ++--- .../urKernelSetSpecializationConstants.cpp | 5 ++- .../testing/include/uur/fixtures.h | 42 +++++++++++++++---- 6 files changed, 55 insertions(+), 20 deletions(-) diff --git a/test/conformance/kernel/kernel_adapter_level_zero.match b/test/conformance/kernel/kernel_adapter_level_zero.match index 75b58b6d48..8194c7ddad 100644 --- a/test/conformance/kernel/kernel_adapter_level_zero.match +++ b/test/conformance/kernel/kernel_adapter_level_zero.match @@ -13,4 +13,14 @@ urKernelSetArgPointerTest.SuccessDevice/Intel_R__oneAPI_Unified_Runtime_over_Lev urKernelSetArgPointerTest.SuccessShared/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgPointerNegativeTest.InvalidNullHandleKernel/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgPointerNegativeTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -Segmentation fault +urKernelSetArgSamplerTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgValueTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetArgValueTest.InvalidKernelArgumentSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetExecInfoTest.SuccessIndirectAccess/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetExecInfoUSMPointersTest.SuccessHost/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetExecInfoUSMPointersTest.SuccessDevice/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetExecInfoUSMPointersTest.SuccessShared/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetSpecializationConstantsTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetSpecializationConstantsTest.InvalidNullHandleKernel/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetSpecializationConstantsTest.InvalidNullPointerSpecConstants/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ +urKernelSetSpecializationConstantsTest.InvalidSizeCount/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ diff --git a/test/conformance/kernel/kernel_adapter_opencl.match b/test/conformance/kernel/kernel_adapter_opencl.match index 9a890011d8..799225be19 100644 --- a/test/conformance/kernel/kernel_adapter_opencl.match +++ b/test/conformance/kernel/kernel_adapter_opencl.match @@ -1,7 +1,3 @@ -urKernelSetArgSamplerTest.Success/Intel_R__OpenCL___{{.*}}_ -urKernelSetArgSamplerTest.InvalidNullHandleKernel/Intel_R__OpenCL___{{.*}}_ -urKernelSetArgSamplerTest.InvalidNullHandleArgValue/Intel_R__OpenCL___{{.*}}_ -urKernelSetArgSamplerTest.InvalidKernelArgumentIndex/Intel_R__OpenCL___{{.*}}_ urKernelSetArgValueTest.InvalidKernelArgumentSize/Intel_R__OpenCL___{{.*}}_ urKernelSetSpecializationConstantsTest.Success/Intel_R__OpenCL___{{.*}}_ urKernelSetSpecializationConstantsTest.InvalidNullHandleKernel/Intel_R__OpenCL___{{.*}}_ diff --git a/test/conformance/kernel/urKernelSetArgPointer.cpp b/test/conformance/kernel/urKernelSetArgPointer.cpp index 50396eb2ed..11d26778c5 100644 --- a/test/conformance/kernel/urKernelSetArgPointer.cpp +++ b/test/conformance/kernel/urKernelSetArgPointer.cpp @@ -15,7 +15,7 @@ struct urKernelSetArgPointerTest : uur::urKernelExecutionTest { if (allocation) { ASSERT_SUCCESS(urUSMFree(context, allocation)); } - UUR_RETURN_ON_FATAL_FAILURE(urKernelTest::TearDown()); + UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::TearDown()); } void ValidateAllocation(void *pointer) { diff --git a/test/conformance/kernel/urKernelSetArgSampler.cpp b/test/conformance/kernel/urKernelSetArgSampler.cpp index 814b79a153..37cb3401f2 100644 --- a/test/conformance/kernel/urKernelSetArgSampler.cpp +++ b/test/conformance/kernel/urKernelSetArgSampler.cpp @@ -5,8 +5,10 @@ #include -struct urKernelSetArgSamplerTest : uur::urKernelTest { +struct urKernelSetArgSamplerTest : uur::urBaseKernelTest { void SetUp() { + program_name = "image_copy"; + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTest::SetUp()); // Images and samplers are not available on AMD ur_platform_backend_t backend; ASSERT_SUCCESS(urPlatformGetInfo(platform, UR_PLATFORM_INFO_BACKEND, @@ -14,9 +16,7 @@ struct urKernelSetArgSamplerTest : uur::urKernelTest { if (backend == UR_PLATFORM_BACKEND_HIP) { GTEST_SKIP() << "Sampler are not supported on hip."; } - - program_name = "image_copy"; - UUR_RETURN_ON_FATAL_FAILURE(urKernelTest::SetUp()); + Build(); ur_sampler_desc_t sampler_desc = { UR_STRUCTURE_TYPE_SAMPLER_DESC, /* sType */ nullptr, /* pNext */ @@ -31,7 +31,7 @@ struct urKernelSetArgSamplerTest : uur::urKernelTest { if (sampler) { ASSERT_SUCCESS(urSamplerRelease(sampler)); } - UUR_RETURN_ON_FATAL_FAILURE(urKernelTest::TearDown()); + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTest::TearDown()); } ur_sampler_handle_t sampler = nullptr; diff --git a/test/conformance/kernel/urKernelSetSpecializationConstants.cpp b/test/conformance/kernel/urKernelSetSpecializationConstants.cpp index 9b2bce7208..665a20de4a 100644 --- a/test/conformance/kernel/urKernelSetSpecializationConstants.cpp +++ b/test/conformance/kernel/urKernelSetSpecializationConstants.cpp @@ -5,10 +5,10 @@ #include -struct urKernelSetSpecializationConstantsTest : uur::urKernelExecutionTest { +struct urKernelSetSpecializationConstantsTest : uur::urBaseKernelExecutionTest { void SetUp() override { program_name = "spec_constant"; - UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelExecutionTest::SetUp()); bool supports_kernel_spec_constant = false; ASSERT_SUCCESS(urDeviceGetInfo( device, UR_DEVICE_INFO_KERNEL_SET_SPECIALIZATION_CONSTANTS, @@ -18,6 +18,7 @@ struct urKernelSetSpecializationConstantsTest : uur::urKernelExecutionTest { GTEST_SKIP() << "Device does not support setting kernel spec constants."; } + Build(); } uint32_t spec_value = 42; diff --git a/test/conformance/testing/include/uur/fixtures.h b/test/conformance/testing/include/uur/fixtures.h index 681db73f05..2ede84d135 100644 --- a/test/conformance/testing/include/uur/fixtures.h +++ b/test/conformance/testing/include/uur/fixtures.h @@ -1089,14 +1089,17 @@ template struct urProgramTestWithParam : urContextTestWithParam { ur_program_handle_t program = nullptr; }; -struct urKernelTest : urProgramTest { +struct urBaseKernelTest : urProgramTest { void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE(urProgramTest::SetUp()); - ASSERT_SUCCESS(urProgramBuild(context, program, nullptr)); auto kernel_names = uur::KernelsEnvironment::instance->GetEntryPointNames(program_name); kernel_name = kernel_names[0]; ASSERT_FALSE(kernel_name.empty()); + } + + void Build() { + ASSERT_SUCCESS(urProgramBuild(context, program, nullptr)); ASSERT_SUCCESS(urKernelCreate(program, kernel_name.data(), &kernel)); } @@ -1111,15 +1114,26 @@ struct urKernelTest : urProgramTest { ur_kernel_handle_t kernel = nullptr; }; -template struct urKernelTestWithParam : urProgramTestWithParam { +struct urKernelTest : urBaseKernelTest { + void SetUp() override { + urBaseKernelTest::SetUp(); + Build(); + } +}; + +template +struct urBaseKernelTestWithParam : urProgramTestWithParam { void SetUp() override { UUR_RETURN_ON_FATAL_FAILURE(urProgramTestWithParam::SetUp()); - ASSERT_SUCCESS(urProgramBuild(this->context, this->program, nullptr)); auto kernel_names = uur::KernelsEnvironment::instance->GetEntryPointNames( this->program_name); kernel_name = kernel_names[0]; ASSERT_FALSE(kernel_name.empty()); + } + + void Build() { + ASSERT_SUCCESS(urProgramBuild(this->context, this->program, nullptr)); ASSERT_SUCCESS( urKernelCreate(this->program, kernel_name.data(), &kernel)); } @@ -1135,16 +1149,23 @@ template struct urKernelTestWithParam : urProgramTestWithParam { ur_kernel_handle_t kernel = nullptr; }; -struct urKernelExecutionTest : urKernelTest { +template struct urKernelTestWithParam : urBaseKernelTestWithParam { + void SetUp() override { + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTestWithParam::SetUp()); + urBaseKernelTestWithParam::Build(); + } +}; + +struct urBaseKernelExecutionTest : urBaseKernelTest { void SetUp() override { - UUR_RETURN_ON_FATAL_FAILURE(urKernelTest::SetUp()); + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTest::SetUp()); } void TearDown() override { for (auto &buffer : buffer_args) { ASSERT_SUCCESS(urMemRelease(buffer)); } - UUR_RETURN_ON_FATAL_FAILURE(urKernelTest::TearDown()); + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelTest::TearDown()); } // Adds a kernel arg representing a sycl buffer constructed with a 1D range. @@ -1233,6 +1254,13 @@ struct urKernelExecutionTest : urKernelTest { uint32_t current_arg_index = 0; }; +struct urKernelExecutionTest : urBaseKernelExecutionTest { + void SetUp() { + UUR_RETURN_ON_FATAL_FAILURE(urBaseKernelExecutionTest::SetUp()); + Build(); + } +}; + template struct GlobalVar { std::string name; T value; From 3c568c3d7b63bb830f2bd85440118135d22f26dd Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 4 Dec 2023 13:35:15 +0000 Subject: [PATCH 137/145] [CTS] Update ctest_parser.py script Update the `scripts/ctest_parser.py` to work with the adapter branch changes. --- scripts/ctest_parser.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/ctest_parser.py b/scripts/ctest_parser.py index f41ba5ea60..1f9c4f6cfe 100644 --- a/scripts/ctest_parser.py +++ b/scripts/ctest_parser.py @@ -15,11 +15,13 @@ TMP_RESULTS_FILE = "tmp-results-file.json" def get_cts_test_suite_names(working_directory): - process = Popen(["ctest", "--show-only=json-v1"], cwd=working_directory, + process = Popen(["ctest", "--show-only=json-v1"], cwd=working_directory, stdout=PIPE, env=os.environ.copy()) out,_ = process.communicate() testsuites = json.loads(out) - return [test['name']for test in testsuites['tests']] + return [ + test['name'][:test['name'].rfind('-')] for test in testsuites['tests'] + ] def percent(amount, total): return round((amount / total) * 100, 2) @@ -39,7 +41,7 @@ def summarize_results(results): crash_rate = percent(total_crashed, total) ljust_param = len(str(total)) - + print( f"""[CTest Parser] Results: Total [{str(total).ljust(ljust_param)}] @@ -85,7 +87,7 @@ def run(args): results[suite] = {} test_executable = f"{args.ctest_path}/bin/test-{suite}" process = Popen([test_executable, "--gtest_list_tests"], env=env, - stdout=DEVNULL if args.quiet else None, + stdout=DEVNULL if args.quiet else None, stderr=DEVNULL if args.quiet else None) process.wait() try: @@ -98,8 +100,8 @@ def run(args): for suite in test_suite_names: ctest_path = f"{args.ctest_path}/test/conformance/{suite}" - process = Popen(['ctest',ctest_path], env=env, cwd=ctest_path, - stdout=DEVNULL if args.quiet else None, + process = Popen(['ctest',ctest_path], env=env, cwd=ctest_path, + stdout=DEVNULL if args.quiet else None, stderr=DEVNULL if args.quiet else None) process.wait() @@ -111,7 +113,7 @@ def run(args): except FileNotFoundError: results[suite]['actual'] = None print('\033[91m' + f"Conformance test suite '{suite}' : likely crashed!" + '\033[0m') - + return results def dir_path(string): From 5dc6e464c83fa41045d4f352a300db9b16400d1d Mon Sep 17 00:00:00 2001 From: Hugh Delaney Date: Thu, 19 Oct 2023 17:09:28 +0100 Subject: [PATCH 138/145] HIP adapter multi dev ctx --- source/adapters/hip/context.cpp | 12 +- source/adapters/hip/context.hpp | 61 ++- source/adapters/hip/device.hpp | 11 +- source/adapters/hip/enqueue.cpp | 233 ++++++--- source/adapters/hip/event.cpp | 3 +- source/adapters/hip/event.hpp | 2 + source/adapters/hip/kernel.cpp | 19 +- source/adapters/hip/kernel.hpp | 30 +- source/adapters/hip/memory.cpp | 467 +++++++++--------- source/adapters/hip/memory.hpp | 389 +++++++++++++-- source/adapters/hip/platform.cpp | 31 +- source/adapters/hip/program.cpp | 44 +- source/adapters/hip/program.hpp | 15 +- source/adapters/hip/queue.cpp | 17 +- source/adapters/hip/usm.cpp | 57 ++- source/ur/ur.hpp | 12 + test/adapters/hip/test_context.cpp | 12 +- .../context/context_adapter_hip.match | 1 + .../memory/memory_adapter_hip.match | 12 +- 19 files changed, 955 insertions(+), 473 deletions(-) diff --git a/source/adapters/hip/context.cpp b/source/adapters/hip/context.cpp index 8298d513d8..73ac777edb 100644 --- a/source/adapters/hip/context.cpp +++ b/source/adapters/hip/context.cpp @@ -40,15 +40,13 @@ ur_context_handle_t_::getOwningURPool(umf_memory_pool_t *UMFPool) { UR_APIEXPORT ur_result_t UR_APICALL urContextCreate( uint32_t DeviceCount, const ur_device_handle_t *phDevices, const ur_context_properties_t *, ur_context_handle_t *phContext) { - std::ignore = DeviceCount; - assert(DeviceCount == 1); ur_result_t RetErr = UR_RESULT_SUCCESS; std::unique_ptr ContextPtr{nullptr}; try { // Create a scoped context. ContextPtr = std::unique_ptr( - new ur_context_handle_t_{*phDevices}); + new ur_context_handle_t_{phDevices, DeviceCount}); static std::once_flag InitFlag; std::call_once( @@ -78,9 +76,9 @@ urContextGetInfo(ur_context_handle_t hContext, ur_context_info_t propName, switch (uint32_t{propName}) { case UR_CONTEXT_INFO_NUM_DEVICES: - return ReturnValue(1); + return ReturnValue(static_cast(hContext->Devices.size())); case UR_CONTEXT_INFO_DEVICES: - return ReturnValue(hContext->getDevice()); + return ReturnValue(hContext->getDevices()); case UR_CONTEXT_INFO_REFERENCE_COUNT: return ReturnValue(hContext->getReferenceCount()); case UR_CONTEXT_INFO_ATOMIC_MEMORY_ORDER_CAPABILITIES: @@ -124,8 +122,10 @@ urContextRetain(ur_context_handle_t hContext) { UR_APIEXPORT ur_result_t UR_APICALL urContextGetNativeHandle( ur_context_handle_t hContext, ur_native_handle_t *phNativeContext) { + // FIXME: this entry point has been deprecated in the SYCL RT and should be + // changed to unsupported once the deprecation period has elapsed *phNativeContext = reinterpret_cast( - hContext->getDevice()->getNativeContext()); + hContext->getDevices()[0]->getNativeContext()); return UR_RESULT_SUCCESS; } diff --git a/source/adapters/hip/context.hpp b/source/adapters/hip/context.hpp index d5eb2e1df8..69d4df9b6d 100644 --- a/source/adapters/hip/context.hpp +++ b/source/adapters/hip/context.hpp @@ -28,26 +28,26 @@ typedef void (*ur_context_extended_deleter_t)(void *UserData); /// /// One of the main differences between the UR API and the HIP driver API is /// that the second modifies the state of the threads by assigning -/// `hipCtx_t` objects to threads. `hipCtx_t` objects store data associated +/// \c hipCtx_t objects to threads. \c hipCtx_t objects store data associated /// with a given device and control access to said device from the user side. /// UR API context are objects that are passed to functions, and not bound /// to threads. -/// The ur_context_handle_t_ object doesn't implement this behavior. It only -/// holds the HIP context data. The RAII object \ref ScopedContext implements -/// the active context behavior. /// -/// Primary vs UserDefined context +/// Since the \c ur_context_handle_t can contain multiple devices, and a \c +/// hipCtx_t refers to only a single device, the \c hipCtx_t is more tightly +/// coupled to a \c ur_device_handle_t than a \c ur_context_handle_t. In order +/// to remove some ambiguities about the different semantics of \c +/// \c ur_context_handle_t and native \c hipCtx_t, we access the native \c +/// hipCtx_t solely through the \c ur_device_handle_t class, by using the object +/// \ref ScopedContext, which sets the active device (by setting the active +/// native \c hipCtx_t). /// -/// HIP has two different types of context, the Primary context, -/// which is usable by all threads on a given process for a given device, and -/// the aforementioned custom contexts. -/// The HIP documentation, and performance analysis, suggest using the Primary -/// context whenever possible. The Primary context is also used by the HIP -/// Runtime API. For UR applications to interop with HIP Runtime API, they have -/// to use the primary context - and make that active in the thread. The -/// `ur_context_handle_t_` object can be constructed with a `kind` parameter -/// that allows to construct a Primary or `UserDefined` context, so that -/// the UR object interface is always the same. +/// Primary vs User-defined \c hipCtx_t +/// +/// HIP has two different types of \c hipCtx_t, the Primary context, which is +/// usable by all threads on a given process for a given device, and the +/// aforementioned custom \c hipCtx_t s. The HIP documentation, confirmed with +/// performance analysis, suggest using the Primary context whenever possible. /// /// Destructor callback /// @@ -57,6 +57,16 @@ typedef void (*ur_context_extended_deleter_t)(void *UserData); /// See proposal for details. /// https://github.com/codeplaysoftware/standards-proposals/blob/master/extended-context-destruction/index.md /// +/// Memory Management for Devices in a Context <\b> +/// +/// A \c ur_mem_handle_t is associated with a \c ur_context_handle_t_, which +/// may refer to multiple devices. Therefore the \c ur_mem_handle_t must +/// handle a native allocation for each device in the context. UR is +/// responsible for automatically handling event dependencies for kernels +/// writing to or reading from the same \c ur_mem_handle_t and migrating memory +/// between native allocations for devices in the same \c ur_context_handle_t_ +/// if necessary. +/// struct ur_context_handle_t_ { struct deleter_data { @@ -68,15 +78,22 @@ struct ur_context_handle_t_ { using native_type = hipCtx_t; - ur_device_handle_t DeviceId; + std::vector Devices; + std::atomic_uint32_t RefCount; - ur_context_handle_t_(ur_device_handle_t DevId) - : DeviceId{DevId}, RefCount{1} { - urDeviceRetain(DeviceId); + ur_context_handle_t_(const ur_device_handle_t *Devs, uint32_t NumDevices) + : Devices{Devs, Devs + NumDevices}, RefCount{1} { + for (auto &Dev : Devices) { + urDeviceRetain(Dev); + } }; - ~ur_context_handle_t_() { urDeviceRelease(DeviceId); } + ~ur_context_handle_t_() { + for (auto &Dev : Devices) { + urDeviceRelease(Dev); + } + } void invokeExtendedDeleters() { std::lock_guard Guard(Mutex); @@ -91,7 +108,9 @@ struct ur_context_handle_t_ { ExtendedDeleters.emplace_back(deleter_data{Function, UserData}); } - ur_device_handle_t getDevice() const noexcept { return DeviceId; } + const std::vector &getDevices() const noexcept { + return Devices; + } uint32_t incrementReferenceCount() noexcept { return ++RefCount; } diff --git a/source/adapters/hip/device.hpp b/source/adapters/hip/device.hpp index 83cc2ee954..bea2c46fb5 100644 --- a/source/adapters/hip/device.hpp +++ b/source/adapters/hip/device.hpp @@ -25,12 +25,13 @@ struct ur_device_handle_t_ { std::atomic_uint32_t RefCount; ur_platform_handle_t Platform; hipCtx_t HIPContext; + uint32_t DeviceIndex; public: ur_device_handle_t_(native_type HipDevice, hipCtx_t Context, - ur_platform_handle_t Platform) + ur_platform_handle_t Platform, uint32_t DeviceIndex) : HIPDevice(HipDevice), RefCount{1}, Platform(Platform), - HIPContext(Context) {} + HIPContext(Context), DeviceIndex(DeviceIndex) {} ~ur_device_handle_t_() { UR_CHECK_ERROR(hipDevicePrimaryCtxRelease(HIPDevice)); @@ -42,7 +43,11 @@ struct ur_device_handle_t_ { ur_platform_handle_t getPlatform() const noexcept { return Platform; }; - hipCtx_t getNativeContext() { return HIPContext; }; + hipCtx_t getNativeContext() const noexcept { return HIPContext; }; + + // Returns the index of the device relative to the other devices in the same + // platform + uint32_t getIndex() const noexcept { return DeviceIndex; }; }; int getAttribute(ur_device_handle_t Device, hipDeviceAttribute_t Attribute); diff --git a/source/adapters/hip/enqueue.cpp b/source/adapters/hip/enqueue.cpp index 1a73618c77..078d3ae399 100644 --- a/source/adapters/hip/enqueue.cpp +++ b/source/adapters/hip/enqueue.cpp @@ -36,19 +36,18 @@ static size_t imageElementByteSize(hipArray_Format ArrayFormat) { return 0; } -ur_result_t enqueueEventsWait(ur_queue_handle_t CommandQueue, - hipStream_t Stream, uint32_t NumEventsInWaitList, +ur_result_t enqueueEventsWait(ur_queue_handle_t, hipStream_t Stream, + uint32_t NumEventsInWaitList, const ur_event_handle_t *EventWaitList) { if (!EventWaitList) { return UR_RESULT_SUCCESS; } try { - ScopedContext Active(CommandQueue->getDevice()); - auto Result = forLatestEvents( EventWaitList, NumEventsInWaitList, [Stream](ur_event_handle_t Event) -> ur_result_t { - if (Event->getStream() == Stream) { + ScopedContext Active(Event->getDevice()); + if (Event->isCompleted() || Event->getStream() == Stream) { return UR_RESULT_SUCCESS; } else { UR_CHECK_ERROR(hipStreamWaitEvent(Stream, Event->get(), 0)); @@ -95,6 +94,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); UR_ASSERT(!(phEventWaitList != NULL && numEventsInWaitList == 0), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); ur_result_t Result = UR_RESULT_SUCCESS; std::unique_ptr RetImplEvent{nullptr}; @@ -102,8 +102,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( try { ScopedContext Active(hQueue->getDevice()); hipStream_t HIPStream = hQueue->getNextTransferStream(); - Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, - phEventWaitList); + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, + phEventWaitList)); if (phEvent) { RetImplEvent = @@ -112,9 +112,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( UR_CHECK_ERROR(RetImplEvent->start()); } - UR_CHECK_ERROR(hipMemcpyHtoDAsync( - std::get(hBuffer->Mem).getWithOffset(offset), - const_cast(pSrc), size, HIPStream)); + UR_CHECK_ERROR( + hipMemcpyHtoDAsync(std::get(hBuffer->Mem) + .getPtrWithOffset(hQueue->getDevice(), offset), + const_cast(pSrc), size, HIPStream)); if (phEvent) { UR_CHECK_ERROR(RetImplEvent->record()); @@ -141,15 +142,34 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead( UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); UR_ASSERT(!(phEventWaitList != NULL && numEventsInWaitList == 0), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); + UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST); - ur_result_t Result = UR_RESULT_SUCCESS; std::unique_ptr RetImplEvent{nullptr}; + ur_lock MemoryMigrationLock{hBuffer->MemoryMigrationMutex}; + auto Device = hQueue->getDevice(); + hipStream_t HIPStream = hQueue->getNextTransferStream(); + try { - ScopedContext Active(hQueue->getDevice()); - hipStream_t HIPStream = hQueue->getNextTransferStream(); - Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, - phEventWaitList); + // Note that this entry point may be called on a queue that may not be the + // last queue to write to the MemBuffer, meaning we must perform the copy + // from a different device + if (hBuffer->LastEventWritingToMemObj && + hBuffer->LastEventWritingToMemObj->getDevice() != hQueue->getDevice()) { + Device = hBuffer->LastEventWritingToMemObj->getDevice(); + ScopedContext Active(Device); + HIPStream = hipStream_t{0}; // Default stream for different device + // We may have to wait for an event on another queue if it is the last + // event writing to mem obj + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, 1, + &hBuffer->LastEventWritingToMemObj)); + } + + ScopedContext Active(Device); + + // Use the default stream if copying from another device + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, + phEventWaitList)); if (phEvent) { RetImplEvent = @@ -158,9 +178,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead( UR_CHECK_ERROR(RetImplEvent->start()); } + // Copying from the device with latest version of memory, not necessarily + // the device associated with the Queue UR_CHECK_ERROR(hipMemcpyDtoHAsync( - pDst, std::get(hBuffer->Mem).getWithOffset(offset), size, - HIPStream)); + pDst, + std::get(hBuffer->Mem).getPtrWithOffset(Device, offset), + size, HIPStream)); if (phEvent) { UR_CHECK_ERROR(RetImplEvent->record()); @@ -175,9 +198,9 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead( } } catch (ur_result_t err) { - Result = err; + return err; } - return Result; + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( @@ -190,9 +213,44 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( UR_ASSERT(workDim > 0, UR_RESULT_ERROR_INVALID_WORK_DIMENSION); UR_ASSERT(workDim < 4, UR_RESULT_ERROR_INVALID_WORK_DIMENSION); + std::vector DepEvents( + phEventWaitList, phEventWaitList + numEventsInWaitList); + std::vector> MemMigrationLocks; + + // phEventWaitList only contains events that are handed to UR by the SYCL + // runtime. However since UR handles memory dependencies within a context + // we may need to add more events to our dependent events list if the UR + // context contains multiple devices + if (hQueue->getContext()->Devices.size() > 1) { + MemMigrationLocks.reserve(hKernel->Args.MemObjArgs.size()); + for (auto &MemArg : hKernel->Args.MemObjArgs) { + bool PushBack = false; + if (auto MemDepEvent = MemArg.Mem->LastEventWritingToMemObj; + MemDepEvent && std::find(DepEvents.begin(), DepEvents.end(), + MemDepEvent) == DepEvents.end()) { + DepEvents.push_back(MemDepEvent); + PushBack = true; + } + if ((MemArg.AccessFlags & + (UR_MEM_FLAG_READ_WRITE | UR_MEM_FLAG_WRITE_ONLY)) || + PushBack) { + if (std::find_if(MemMigrationLocks.begin(), MemMigrationLocks.end(), + [MemArg](auto &Lock) { + return Lock.first == MemArg.Mem; + }) == MemMigrationLocks.end()) + MemMigrationLocks.emplace_back( + std::pair{MemArg.Mem, ur_lock{MemArg.Mem->MemoryMigrationMutex}}); + } + } + } + + // Early exit for zero size range kernel if (*pGlobalWorkSize == 0) { - return urEnqueueEventsWaitWithBarrier(hQueue, numEventsInWaitList, - phEventWaitList, phEvent); + if (DepEvents.size()) { + return urEnqueueEventsWaitWithBarrier(hQueue, DepEvents.size(), + phEventWaitList, phEvent); + } + return UR_RESULT_SUCCESS; } // Set the number of threads per block to the number of threads per warp @@ -265,8 +323,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( numEventsInWaitList, phEventWaitList, Guard, &StreamToken); hipFunction_t HIPFunc = hKernel->get(); - Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, - phEventWaitList); + if (DepEvents.size()) { + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, DepEvents.size(), + DepEvents.data())); + } + + // For memory migration across devices in the same context + if (hQueue->getContext()->Devices.size() > 1) { + for (auto &MemArg : hKernel->Args.MemObjArgs) { + migrateMemoryToDeviceIfNeeded(MemArg.Mem, hQueue->getDevice()); + } + } // Set the implicit global offset parameter if kernel has offset variant if (hKernel->getWithOffsetParameter()) { @@ -293,6 +360,20 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( UR_CHECK_ERROR(RetImplEvent->start()); } + // Once event has been started we can unlock MemoryMigrationMutex + if (hQueue->getContext()->Devices.size() > 1) { + for (auto &MemArg : hKernel->Args.MemObjArgs) { + // Telling the ur_mem_handle_t that it will need to wait on this kernel + // if it has been written to + if (phEvent && (MemArg.AccessFlags & + (UR_MEM_FLAG_READ_WRITE | UR_MEM_FLAG_WRITE_ONLY))) { + MemArg.Mem->setLastEventWritingToMemObj(RetImplEvent.get()); + } + } + // We can release the MemoryMigrationMutexes now + MemMigrationLocks.clear(); + } + // Set local mem max size if env var is present static const char *LocalMemSzPtrUR = std::getenv("UR_HIP_MAX_LOCAL_MEM_SIZE"); @@ -509,16 +590,32 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect( UR_ASSERT(!(hostSlicePitch != 0 && hostSlicePitch % hostRowPitch != 0), UR_RESULT_ERROR_INVALID_SIZE); - ur_result_t Result = UR_RESULT_SUCCESS; - void *DevPtr = std::get(hBuffer->Mem).getVoid(); std::unique_ptr RetImplEvent{nullptr}; + ur_result_t Result = UR_RESULT_SUCCESS; + ur_lock MemoryMigrationLock(hBuffer->MemoryMigrationMutex); + auto Device = hQueue->getDevice(); + hipStream_t HIPStream = hQueue->getNextTransferStream(); + try { - ScopedContext Active(hQueue->getDevice()); - hipStream_t HIPStream = hQueue->getNextTransferStream(); + // Note that this entry point may be called on a queue that may not be the + // last queue to write to the MemBuffer, meaning we must perform the copy + // from a different device + if (hBuffer->LastEventWritingToMemObj && + hBuffer->LastEventWritingToMemObj->getDevice() != hQueue->getDevice()) { + Device = hBuffer->LastEventWritingToMemObj->getDevice(); + ScopedContext Active(Device); + HIPStream = hipStream_t{0}; // Default stream for different device + // We may have to wait for an event on another queue if it is the last + // event writing to mem obj + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, 1, + &hBuffer->LastEventWritingToMemObj)); + } - Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, - phEventWaitList); + ScopedContext Active(Device); + + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, + phEventWaitList)); if (phEvent) { RetImplEvent = @@ -527,10 +624,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect( UR_CHECK_ERROR(RetImplEvent->start()); } - Result = commonEnqueueMemBufferCopyRect( + void *DevPtr = std::get(hBuffer->Mem).getVoid(Device); + UR_CHECK_ERROR(commonEnqueueMemBufferCopyRect( HIPStream, region, &DevPtr, hipMemoryTypeDevice, bufferOrigin, bufferRowPitch, bufferSlicePitch, pDst, hipMemoryTypeHost, hostOrigin, - hostRowPitch, hostSlicePitch); + hostRowPitch, hostSlicePitch)); if (phEvent) { UR_CHECK_ERROR(RetImplEvent->record()); @@ -558,7 +656,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { ur_result_t Result = UR_RESULT_SUCCESS; - void *DevPtr = std::get(hBuffer->Mem).getVoid(); + void *DevPtr = std::get(hBuffer->Mem).getVoid(hQueue->getDevice()); std::unique_ptr RetImplEvent{nullptr}; try { @@ -626,8 +724,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy( UR_CHECK_ERROR(RetImplEvent->start()); } - auto Src = std::get(hBufferSrc->Mem).getWithOffset(srcOffset); - auto Dst = std::get(hBufferDst->Mem).getWithOffset(dstOffset); + auto Src = std::get(hBufferSrc->Mem) + .getPtrWithOffset(hQueue->getDevice(), srcOffset); + auto Dst = std::get(hBufferDst->Mem) + .getPtrWithOffset(hQueue->getDevice(), dstOffset); UR_CHECK_ERROR(hipMemcpyDtoDAsync(Dst, Src, size, Stream)); @@ -652,8 +752,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { ur_result_t Result = UR_RESULT_SUCCESS; - void *SrcPtr = std::get(hBufferSrc->Mem).getVoid(); - void *DstPtr = std::get(hBufferDst->Mem).getVoid(); + void *SrcPtr = + std::get(hBufferSrc->Mem).getVoid(hQueue->getDevice()); + void *DstPtr = + std::get(hBufferDst->Mem).getVoid(hQueue->getDevice()); std::unique_ptr RetImplEvent{nullptr}; try { @@ -762,7 +864,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( UR_CHECK_ERROR(RetImplEvent->start()); } - auto DstDevice = std::get(hBuffer->Mem).getWithOffset(offset); + auto DstDevice = std::get(hBuffer->Mem) + .getPtrWithOffset(hQueue->getDevice(), offset); auto N = size / patternSize; // pattern size in bytes @@ -882,21 +985,37 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead( ur_rect_offset_t origin, ur_rect_region_t region, size_t, size_t, void *pDst, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - UR_ASSERT(hImage->MemType == ur_mem_handle_t_::Type::Surface, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); + UR_ASSERT(hImage->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); ur_result_t Result = UR_RESULT_SUCCESS; + ur_lock MemoryMigrationLock{hImage->MemoryMigrationMutex}; + auto Device = hQueue->getDevice(); + hipStream_t HIPStream = hQueue->getNextTransferStream(); + try { - ScopedContext Active(hQueue->getDevice()); - hipStream_t HIPStream = hQueue->getNextTransferStream(); + // Note that this entry point may be called on a queue that may not be the + // last queue to write to the MemBuffer, meaning we must perform the copy + // from a different device + if (hImage->LastEventWritingToMemObj && + hImage->LastEventWritingToMemObj->getDevice() != hQueue->getDevice()) { + Device = hImage->LastEventWritingToMemObj->getDevice(); + ScopedContext Active(Device); + HIPStream = hipStream_t{0}; // Default stream for different device + // We may have to wait for an event on another queue if it is the last + // event writing to mem obj + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, 1, + &hImage->LastEventWritingToMemObj)); + } + + ScopedContext Active(Device); if (phEventWaitList) { - Result = enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, - phEventWaitList); + UR_CHECK_ERROR(enqueueEventsWait(hQueue, HIPStream, numEventsInWaitList, + phEventWaitList)); } - hipArray *Array = std::get(hImage->Mem).getArray(); + hipArray *Array = std::get(hImage->Mem).getArray(Device); hipArray_Format Format; size_t NumChannels; @@ -950,8 +1069,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_rect_offset_t origin, ur_rect_region_t region, size_t, size_t, void *pSrc, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - UR_ASSERT(hImage->MemType == ur_mem_handle_t_::Type::Surface, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); + UR_ASSERT(hImage->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); ur_result_t Result = UR_RESULT_SUCCESS; @@ -964,7 +1082,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( phEventWaitList); } - hipArray *Array = std::get(hImage->Mem).getArray(); + hipArray *Array = + std::get(hImage->Mem).getArray(hQueue->getDevice()); hipArray_Format Format; size_t NumChannels; @@ -1017,10 +1136,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( ur_rect_offset_t dstOrigin, ur_rect_region_t region, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - UR_ASSERT(hImageSrc->MemType == ur_mem_handle_t_::Type::Surface, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); - UR_ASSERT(hImageDst->MemType == ur_mem_handle_t_::Type::Surface, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); + UR_ASSERT(hImageSrc->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); + UR_ASSERT(hImageDst->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); UR_ASSERT(std::get(hImageSrc->Mem).getImageType() == std::get(hImageDst->Mem).getImageType(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); @@ -1035,12 +1152,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( phEventWaitList); } - hipArray *SrcArray = std::get(hImageSrc->Mem).getArray(); + hipArray *SrcArray = + std::get(hImageSrc->Mem).getArray(hQueue->getDevice()); hipArray_Format SrcFormat; size_t SrcNumChannels; getArrayDesc(SrcArray, SrcFormat, SrcNumChannels); - hipArray *DstArray = std::get(hImageDst->Mem).getArray(); + hipArray *DstArray = + std::get(hImageDst->Mem).getArray(hQueue->getDevice()); hipArray_Format DstFormat; size_t DstNumChannels; getArrayDesc(DstArray, DstFormat, DstNumChannels); @@ -1101,8 +1220,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_map_flags_t mapFlags, size_t offset, size_t size, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent, void **ppRetMap) { - UR_ASSERT(hBuffer->MemType == ur_mem_handle_t_::Type::Buffer, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); + UR_ASSERT(hBuffer->isBuffer(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); auto &BufferImpl = std::get(hBuffer->Mem); UR_ASSERT(offset + size <= BufferImpl.getSize(), UR_RESULT_ERROR_INVALID_SIZE); @@ -1161,8 +1279,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemUnmap( uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { ur_result_t Result = UR_RESULT_SUCCESS; - UR_ASSERT(hMem->MemType == ur_mem_handle_t_::Type::Buffer, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); + UR_ASSERT(hMem->isBuffer(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); UR_ASSERT(std::get(hMem->Mem).getMapPtr() != nullptr, UR_RESULT_ERROR_INVALID_MEM_OBJECT); UR_ASSERT(std::get(hMem->Mem).getMapPtr() == pMappedPtr, @@ -1302,7 +1419,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( ur_usm_migration_flags_t flags, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { void *HIPDevicePtr = const_cast(pMem); - ur_device_handle_t Device = hQueue->getContext()->getDevice(); + ur_device_handle_t Device = hQueue->getDevice(); // If the device does not support managed memory access, we can't set // mem_advise. diff --git a/source/adapters/hip/event.cpp b/source/adapters/hip/event.cpp index 4871335c9f..2af6c5e910 100644 --- a/source/adapters/hip/event.cpp +++ b/source/adapters/hip/event.cpp @@ -193,7 +193,7 @@ urEventWait(uint32_t numEvents, const ur_event_handle_t *phEventWaitList) { try { auto Context = phEventWaitList[0]->getContext(); - ScopedContext Active(Context->getDevice()); + ScopedContext Active(phEventWaitList[0]->getDevice()); auto WaitFunc = [Context](ur_event_handle_t Event) -> ur_result_t { UR_ASSERT(Event, UR_RESULT_ERROR_INVALID_EVENT); @@ -292,7 +292,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventRelease(ur_event_handle_t hEvent) { std::unique_ptr event_ptr{hEvent}; ur_result_t Result = UR_RESULT_ERROR_INVALID_EVENT; try { - ScopedContext Active(hEvent->getContext()->getDevice()); Result = hEvent->release(); } catch (...) { Result = UR_RESULT_ERROR_OUT_OF_RESOURCES; diff --git a/source/adapters/hip/event.hpp b/source/adapters/hip/event.hpp index bfa05b59d7..ecb995dfbe 100644 --- a/source/adapters/hip/event.hpp +++ b/source/adapters/hip/event.hpp @@ -28,6 +28,8 @@ struct ur_event_handle_t_ { ur_queue_handle_t getQueue() const noexcept { return Queue; } + ur_device_handle_t getDevice() const noexcept { return Queue->getDevice(); } + hipStream_t getStream() const noexcept { return Stream; } uint32_t getComputeStreamToken() const noexcept { return StreamToken; } diff --git a/source/adapters/hip/kernel.cpp b/source/adapters/hip/kernel.cpp index cc6f4384bc..ec58bafcc6 100644 --- a/source/adapters/hip/kernel.cpp +++ b/source/adapters/hip/kernel.cpp @@ -19,7 +19,7 @@ urKernelCreate(ur_program_handle_t hProgram, const char *pKernelName, std::unique_ptr RetKernel{nullptr}; try { - ScopedContext Active(hProgram->getContext()->getDevice()); + ScopedContext Active(hProgram->getDevice()); hipFunction_t HIPFunc; hipError_t KernelError = @@ -263,9 +263,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgPointer( return UR_RESULT_SUCCESS; } -UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgMemObj( - ur_kernel_handle_t hKernel, uint32_t argIndex, - const ur_kernel_arg_mem_obj_properties_t *, ur_mem_handle_t hArgValue) { +UR_APIEXPORT ur_result_t UR_APICALL +urKernelSetArgMemObj(ur_kernel_handle_t hKernel, uint32_t argIndex, + const ur_kernel_arg_mem_obj_properties_t *Properties, + ur_mem_handle_t hArgValue) { // Below sets kernel arg when zero-sized buffers are handled. // In such case the corresponding memory is null. if (hArgValue == nullptr) { @@ -275,8 +276,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgMemObj( ur_result_t Result = UR_RESULT_SUCCESS; try { - if (hArgValue->MemType == ur_mem_handle_t_::Type::Surface) { - auto array = std::get(hArgValue->Mem).getArray(); + auto Device = hKernel->getProgram()->getDevice(); + hKernel->Args.addMemObjArg(argIndex, hArgValue, Properties->memoryAccess); + if (hArgValue->isImage()) { + auto array = std::get(hArgValue->Mem).getArray(Device); hipArray_Format Format; size_t NumChannels; getArrayDesc(array, Format, NumChannels); @@ -288,10 +291,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelSetArgMemObj( "uint32, float, and half."); } hipSurfaceObject_t hipSurf = - std::get(hArgValue->Mem).getSurface(); + std::get(hArgValue->Mem).getSurface(Device); hKernel->setKernelArg(argIndex, sizeof(hipSurf), (void *)&hipSurf); } else { - void *HIPPtr = std::get(hArgValue->Mem).getVoid(); + void *HIPPtr = std::get(hArgValue->Mem).getVoid(Device); hKernel->setKernelArg(argIndex, sizeof(void *), (void *)&HIPPtr); } } catch (ur_result_t Err) { diff --git a/source/adapters/hip/kernel.hpp b/source/adapters/hip/kernel.hpp index f13478a69c..83693a3d41 100644 --- a/source/adapters/hip/kernel.hpp +++ b/source/adapters/hip/kernel.hpp @@ -57,6 +57,14 @@ struct ur_kernel_handle_t_ { args_size_t ParamSizes; args_index_t Indices; args_size_t OffsetPerIndex; + // A struct to keep track of memargs so that we can do dependency analysis + // at urEnqueueKernelLaunch + struct mem_obj_arg { + ur_mem_handle_t_ *Mem; + int Index; + ur_mem_flags_t AccessFlags; + }; + std::vector MemObjArgs; std::uint32_t ImplicitOffsetArgs[3] = {0, 0, 0}; @@ -110,6 +118,20 @@ struct ur_kernel_handle_t_ { Size + AlignedLocalOffset - LocalOffset); } + void addMemObjArg(int Index, ur_mem_handle_t hMem, ur_mem_flags_t Flags) { + assert(hMem && "Invalid mem handle"); + // To avoid redundancy we are not storing mem obj with index i at index + // i in the vec of MemObjArgs. + for (auto &Arg : MemObjArgs) { + if (Arg.Index == Index) { + // Overwrite the mem obj with the same index + Arg = arguments::mem_obj_arg{hMem, Index, Flags}; + return; + } + } + MemObjArgs.push_back(arguments::mem_obj_arg{hMem, Index, Flags}); + } + void setImplicitOffset(size_t Size, std::uint32_t *ImplicitOffset) { assert(Size == sizeof(std::uint32_t) * 3); std::memcpy(ImplicitOffsetArgs, ImplicitOffset, Size); @@ -167,10 +189,10 @@ struct ur_kernel_handle_t_ { const char *getName() const noexcept { return Name.c_str(); } - /// Get the number of kernel arguments, excluding the implicit global offset. - /// Note this only returns the current known number of arguments, not the - /// real one required by the kernel, since this cannot be queried from - /// the HIP Driver API + /// Get the number of kernel arguments, excluding the implicit global + /// offset. Note this only returns the current known number of arguments, + /// not the real one required by the kernel, since this cannot be queried + /// from the HIP Driver API uint32_t getNumArgs() const noexcept { return Args.Indices.size() - 1; } void setKernelArg(int Index, size_t Size, const void *Arg) { diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 899dad5674..68ded26263 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -55,28 +55,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemRelease(ur_mem_handle_t hMem) { return UR_RESULT_SUCCESS; } - ScopedContext Active(uniqueMemObj->getContext()->getDevice()); - - if (hMem->MemType == ur_mem_handle_t_::Type::Buffer) { - auto &hBuffer = std::get(uniqueMemObj->Mem); - switch (hBuffer.MemAllocMode) { - case BufferMem::AllocMode::CopyIn: - case BufferMem::AllocMode::Classic: - UR_CHECK_ERROR(hipFree((void *)hBuffer.Ptr)); - break; - case BufferMem::AllocMode::UseHostPtr: - UR_CHECK_ERROR(hipHostUnregister(hBuffer.HostPtr)); - break; - case BufferMem::AllocMode::AllocHostPtr: - UR_CHECK_ERROR(hipFreeHost(hBuffer.HostPtr)); - }; - } - - else if (hMem->MemType == ur_mem_handle_t_::Type::Surface) { - auto &hImage = std::get(uniqueMemObj->Mem); - UR_CHECK_ERROR(hipDestroySurfaceObject(hImage.getSurface())); - UR_CHECK_ERROR(hipFreeArray(hImage.getArray())); - } + UR_CHECK_ERROR(hMem->clear()); } catch (ur_result_t Err) { Result = Err; @@ -123,49 +102,41 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate( ur_mem_handle_t RetMemObj = nullptr; try { - ScopedContext Active(hContext->getDevice()); - void *Ptr; - auto pHost = pProperties ? pProperties->pHost : nullptr; + auto HostPtr = pProperties ? pProperties->pHost : nullptr; BufferMem::AllocMode AllocMode = BufferMem::AllocMode::Classic; - if ((flags & UR_MEM_FLAG_USE_HOST_POINTER) && EnableUseHostPtr) { - UR_CHECK_ERROR(hipHostRegister(pHost, size, hipHostRegisterMapped)); - UR_CHECK_ERROR(hipHostGetDevicePointer(&Ptr, pHost, 0)); AllocMode = BufferMem::AllocMode::UseHostPtr; } else if (flags & UR_MEM_FLAG_ALLOC_HOST_POINTER) { - UR_CHECK_ERROR(hipHostMalloc(&pHost, size)); - UR_CHECK_ERROR(hipHostGetDevicePointer(&Ptr, pHost, 0)); + UR_CHECK_ERROR(hipHostMalloc(&HostPtr, size)); AllocMode = BufferMem::AllocMode::AllocHostPtr; - } else { - UR_CHECK_ERROR(hipMalloc(&Ptr, size)); - if (flags & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) { - AllocMode = BufferMem::AllocMode::CopyIn; - } + } else if (flags & UR_MEM_FLAG_ALLOC_COPY_HOST_POINTER) { + AllocMode = BufferMem::AllocMode::CopyIn; } - if (Result == UR_RESULT_SUCCESS) { - ur_mem_handle_t parentBuffer = nullptr; - - auto DevPtr = reinterpret_cast(Ptr); - auto URMemObj = std::unique_ptr(new ur_mem_handle_t_{ - hContext, parentBuffer, flags, AllocMode, DevPtr, pHost, size}); - if (URMemObj != nullptr) { - RetMemObj = URMemObj.release(); - if (PerformInitialCopy) { - // Operates on the default stream of the current HIP context. - UR_CHECK_ERROR(hipMemcpyHtoD(DevPtr, pHost, size)); - // Synchronize with default stream implicitly used by hipMemcpyHtoD - // to make buffer data available on device before any other UR call - // uses it. - if (Result == UR_RESULT_SUCCESS) { - hipStream_t defaultStream = 0; - UR_CHECK_ERROR(hipStreamSynchronize(defaultStream)); - } - } - } else { - Result = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + auto URMemObj = std::unique_ptr( + new ur_mem_handle_t_{hContext, flags, AllocMode, HostPtr, size}); + if (URMemObj == nullptr) { + throw UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; + } + + // First allocation will be made at urMemBufferCreate if context only + // has one device + if (PerformInitialCopy && HostPtr) { + // Perform initial copy to every device in context + for (auto &Device : hContext->getDevices()) { + ScopedContext Active(Device); + // getPtr may allocate mem if not already allocated + const auto &Ptr = std::get(URMemObj->Mem).getPtr(Device); + UR_CHECK_ERROR(hipMemcpyHtoD(Ptr, HostPtr, size)); + // TODO check if we can remove this + // Synchronize with default stream implicitly used by cuMemcpyHtoD + // to make buffer data available on device before any other UR + // call uses it. + // hipStream_t defaultStream = 0; + // UR_CHECK_ERROR(hipStreamSynchronize(defaultStream)); } } + RetMemObj = URMemObj.release(); } catch (ur_result_t Err) { Result = Err; } catch (...) { @@ -215,27 +186,17 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferPartition( auto &BufferImpl = std::get(hBuffer->Mem); UR_ASSERT(((pRegion->origin + pRegion->size) <= BufferImpl.getSize()), UR_RESULT_ERROR_INVALID_BUFFER_SIZE); - // Retained indirectly due to retaining parent buffer below. - ur_context_handle_t Context = hBuffer->Context; - BufferMem::AllocMode AllocMode = BufferMem::AllocMode::Classic; - - UR_ASSERT(BufferImpl.Ptr != BufferMem::native_type{0}, - UR_RESULT_ERROR_INVALID_MEM_OBJECT); - BufferMem::native_type Ptr = BufferImpl.getWithOffset(pRegion->origin); - - void *HostPtr = nullptr; - if (BufferImpl.HostPtr) { - HostPtr = static_cast(BufferImpl.HostPtr) + pRegion->origin; + for (auto Device : hBuffer->Context->getDevices()) { + BufferImpl.getPtr(Device); // This is allocating a dev ptr behind the scenes + // which is necessary before SubBuffer partition } ReleaseGuard ReleaseGuard(hBuffer); std::unique_ptr RetMemObj{nullptr}; try { - ScopedContext Active(Context->getDevice()); - - RetMemObj = std::unique_ptr{new ur_mem_handle_t_{ - Context, hBuffer, flags, AllocMode, Ptr, HostPtr, pRegion->size}}; + RetMemObj = std::unique_ptr{ + new ur_mem_handle_t_{hBuffer, pRegion->origin}}; } catch (ur_result_t Err) { *phMem = nullptr; return Err; @@ -258,19 +219,23 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, UR_ASSERT(MemInfoType <= UR_MEM_INFO_CONTEXT, UR_RESULT_ERROR_INVALID_ENUMERATION); - UrReturnHelper ReturnValue(propSize, pMemInfo, pPropSizeRet); + // FIXME: Only getting info for the first device in the context. This + // should be fine in general + auto Device = hMemory->getContext()->getDevices()[0]; + ScopedContext Active(Device); - ScopedContext Active(hMemory->getContext()->getDevice()); + UrReturnHelper ReturnValue(propSize, pMemInfo, pPropSizeRet); switch (MemInfoType) { case UR_MEM_INFO_SIZE: { try { - const auto MemVisitor = [](auto &&Mem) -> size_t { + const auto MemVisitor = [Device](auto &&Mem) -> size_t { using T = std::decay_t; if constexpr (std::is_same_v) { size_t AllocSize = 0; hipDeviceptr_t BasePtr = nullptr; - UR_CHECK_ERROR(hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.Ptr)); + UR_CHECK_ERROR( + hipMemGetAddressRange(&BasePtr, &AllocSize, Mem.getPtr(Device))); return AllocSize; } else if constexpr (std::is_same_v) { #if HIP_VERSION < 50600000 @@ -278,7 +243,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, #else HIP_ARRAY3D_DESCRIPTOR ArrayDescriptor; UR_CHECK_ERROR( - hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray())); + hipArray3DGetDescriptor(&ArrayDescriptor, Mem.getArray(Device))); const auto PixelSizeBytes = GetHipFormatPixelSize(ArrayDescriptor.Format) * ArrayDescriptor.NumChannels; @@ -317,30 +282,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory, /// \param[out] phNativeMem Set to the native handle of the UR mem object. /// /// \return UR_RESULT_SUCCESS -UR_APIEXPORT ur_result_t UR_APICALL -urMemGetNativeHandle(ur_mem_handle_t hMem, ur_native_handle_t *phNativeMem) { -#if defined(__HIP_PLATFORM_NVIDIA__) - if (sizeof(BufferMem::native_type) > sizeof(ur_native_handle_t)) { - // Check that all the upper bits that cannot be represented by - // ur_native_handle_t are empty. - // NOTE: The following shift might trigger a warning, but the check in the - // if above makes sure that this does not underflow. - BufferMem::native_type UpperBits = std::get(hMem->Mem).get() >> - (sizeof(ur_native_handle_t) * CHAR_BIT); - if (UpperBits) { - // Return an error if any of the remaining bits is non-zero. - return UR_RESULT_ERROR_INVALID_MEM_OBJECT; - } - } - *phNativeMem = reinterpret_cast( - std::get(hMem->Mem).get()); -#elif defined(__HIP_PLATFORM_AMD__) - *phNativeMem = reinterpret_cast( - std::get(hMem->Mem).get()); -#else -#error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__"); -#endif - return UR_RESULT_SUCCESS; +UR_APIEXPORT ur_result_t UR_APICALL urMemGetNativeHandle(ur_mem_handle_t, + ur_native_handle_t *) { + // FIXME: there is no good way of doing this with a multi device context. + // If we return a single pointer, how would we know which device's allocation + // it should be? + // If we return a vector of pointers, this is OK for read only access but if + // we write to a buffer, how would we know which one had been written to? + // Should unused allocations be updated afterwards? We have no way of knowing + // any of these things in the current API design. + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle( @@ -356,7 +307,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreateWithNativeHandle( return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -/// \TODO Not implemented UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate( ur_context_handle_t hContext, ur_mem_flags_t flags, const ur_image_format_t *pImageFormat, const ur_image_desc_t *pImageDesc, @@ -389,145 +339,25 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate( UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR); } - ur_result_t Result = UR_RESULT_SUCCESS; - // We only support RBGA channel order // TODO: check SYCL CTS and spec. May also have to support BGRA UR_ASSERT(pImageFormat->channelOrder == UR_IMAGE_CHANNEL_ORDER_RGBA, UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION); - // We have to use hipArray3DCreate, which has some caveats. The height and - // depth parameters must be set to 0 produce 1D or 2D arrays. image_desc gives - // a minimum value of 1, so we need to convert the answer. - HIP_ARRAY3D_DESCRIPTOR ArrayDesc; - ArrayDesc.NumChannels = 4; // Only support 4 channel image - ArrayDesc.Flags = 0; // No flags required - ArrayDesc.Width = pImageDesc->width; - if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { - ArrayDesc.Height = 0; - ArrayDesc.Depth = 0; - } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { - ArrayDesc.Height = pImageDesc->height; - ArrayDesc.Depth = 0; - } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { - ArrayDesc.Height = pImageDesc->height; - ArrayDesc.Depth = pImageDesc->depth; - } + auto URMemObj = std::unique_ptr( + new ur_mem_handle_t_{hContext, flags, *pImageFormat, *pImageDesc, pHost}); - // We need to get this now in bytes for calculating the total image size later - size_t PixelTypeSizeBytes; - - switch (pImageFormat->channelType) { - - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: - ArrayDesc.Format = HIP_AD_FORMAT_UNSIGNED_INT8; - PixelTypeSizeBytes = 1; - break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: - ArrayDesc.Format = HIP_AD_FORMAT_SIGNED_INT8; - PixelTypeSizeBytes = 1; - break; - case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: - ArrayDesc.Format = HIP_AD_FORMAT_UNSIGNED_INT16; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: - ArrayDesc.Format = HIP_AD_FORMAT_SIGNED_INT16; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: - ArrayDesc.Format = HIP_AD_FORMAT_HALF; - PixelTypeSizeBytes = 2; - break; - case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: - ArrayDesc.Format = HIP_AD_FORMAT_UNSIGNED_INT32; - PixelTypeSizeBytes = 4; - break; - case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: - ArrayDesc.Format = HIP_AD_FORMAT_SIGNED_INT32; - PixelTypeSizeBytes = 4; - break; - case UR_IMAGE_CHANNEL_TYPE_FLOAT: - ArrayDesc.Format = HIP_AD_FORMAT_FLOAT; - PixelTypeSizeBytes = 4; - break; - default: - // urMemImageCreate given unsupported image_channel_data_type - return UR_RESULT_ERROR_INVALID_IMAGE_FORMAT_DESCRIPTOR; + if (URMemObj == nullptr) { + return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; } - // When a dimension isn't used image_desc has the size set to 1 - size_t PixelSizeBytes = - PixelTypeSizeBytes * 4; // 4 is the only number of channels we support - size_t ImageSizeBytes = PixelSizeBytes * pImageDesc->width * - pImageDesc->height * pImageDesc->depth; - - ScopedContext Active(hContext->getDevice()); - hipArray *ImageArray; - UR_CHECK_ERROR(hipArray3DCreate(reinterpret_cast(&ImageArray), - &ArrayDesc)); - - try { - if (PerformInitialCopy) { - // We have to use a different copy function for each image dimensionality - if (pImageDesc->type == UR_MEM_TYPE_IMAGE1D) { - UR_CHECK_ERROR(hipMemcpyHtoA(ImageArray, 0, pHost, ImageSizeBytes)); - } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE2D) { - hip_Memcpy2D CpyDesc; - memset(&CpyDesc, 0, sizeof(CpyDesc)); - CpyDesc.srcMemoryType = hipMemoryType::hipMemoryTypeHost; - CpyDesc.srcHost = pHost; - CpyDesc.dstMemoryType = hipMemoryType::hipMemoryTypeArray; - CpyDesc.dstArray = reinterpret_cast(ImageArray); - CpyDesc.WidthInBytes = PixelSizeBytes * pImageDesc->width; - CpyDesc.Height = pImageDesc->height; - UR_CHECK_ERROR(hipMemcpyParam2D(&CpyDesc)); - } else if (pImageDesc->type == UR_MEM_TYPE_IMAGE3D) { - HIP_MEMCPY3D CpyDesc; - memset(&CpyDesc, 0, sizeof(CpyDesc)); - CpyDesc.srcMemoryType = hipMemoryType::hipMemoryTypeHost; - CpyDesc.srcHost = pHost; - CpyDesc.dstMemoryType = hipMemoryType::hipMemoryTypeArray; - CpyDesc.dstArray = reinterpret_cast(ImageArray); - CpyDesc.WidthInBytes = PixelSizeBytes * pImageDesc->width; - CpyDesc.Height = pImageDesc->height; - CpyDesc.Depth = pImageDesc->depth; - UR_CHECK_ERROR(hipDrvMemcpy3D(&CpyDesc)); - } + if (PerformInitialCopy) { + for (const auto &Dev : hContext->getDevices()) { + UR_CHECK_ERROR(migrateMemoryToDeviceIfNeeded(URMemObj.get(), Dev)); } - - // HIP_RESOURCE_DESC is a union of different structs, shown here - // We need to fill it as described here to use it for a surface or texture - // HIP_RESOURCE_DESC::resType must be HIP_RESOURCE_TYPE_ARRAY and - // HIP_RESOURCE_DESC::res::array::hArray must be set to a valid HIP array - // handle. - // HIP_RESOURCE_DESC::flags must be set to zero - - hipResourceDesc ImageResDesc; - ImageResDesc.res.array.array = ImageArray; - ImageResDesc.resType = hipResourceTypeArray; - - hipSurfaceObject_t Surface; - UR_CHECK_ERROR(hipCreateSurfaceObject(&Surface, &ImageResDesc)); - - auto URMemObj = std::unique_ptr(new ur_mem_handle_t_{ - hContext, ImageArray, Surface, flags, pImageDesc->type, pHost}); - - if (URMemObj == nullptr) { - return UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; - } - - *phMem = URMemObj.release(); - } catch (ur_result_t Err) { - UR_CHECK_ERROR(hipFreeArray(ImageArray)); - return Err; - } catch (...) { - UR_CHECK_ERROR(hipFreeArray(ImageArray)); - return UR_RESULT_ERROR_UNKNOWN; } - return Result; + *phMem = URMemObj.release(); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory, @@ -536,14 +366,16 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory, void *pPropValue, size_t *pPropSizeRet) { UR_ASSERT(hMemory->isImage(), UR_RESULT_ERROR_INVALID_MEM_OBJECT); - ScopedContext Active(hMemory->getContext()->getDevice()); + // FIXME: only getting infor for first image in ctx + auto Device = hMemory->getContext()->getDevices()[0]; + ScopedContext Active(Device); UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); try { HIP_ARRAY3D_DESCRIPTOR ArrayInfo; #if HIP_VERSION >= 50600000 UR_CHECK_ERROR(hipArray3DGetDescriptor( - &ArrayInfo, std::get(hMemory->Mem).getArray())); + &ArrayInfo, std::get(hMemory->Mem).getArray(Device))); #else return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; #endif @@ -625,3 +457,174 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemRetain(ur_mem_handle_t hMem) { hMem->incrementReferenceCount(); return UR_RESULT_SUCCESS; } + +inline ur_result_t +allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t Mem, + const ur_device_handle_t hDevice) { + ScopedContext Active(hDevice); + ur_lock LockGuard(Mem->MemoryAllocationMutex); + + if (Mem->isBuffer()) { + auto &Buffer = std::get(Mem->Mem); + hipDeviceptr_t &DevPtr = Buffer.Ptrs[hDevice->getIndex()]; + + // Allocation has already been made + if (DevPtr != BufferMem::native_type{0}) { + return UR_RESULT_SUCCESS; + } + + if (Buffer.MemAllocMode == BufferMem::AllocMode::AllocHostPtr) { + // Host allocation has already been made + UR_CHECK_ERROR(hipHostGetDevicePointer(&DevPtr, Buffer.HostPtr, 0)); + } else if (Buffer.MemAllocMode == BufferMem::AllocMode::UseHostPtr) { + UR_CHECK_ERROR( + hipHostRegister(Buffer.HostPtr, Buffer.Size, hipHostRegisterMapped)); + UR_CHECK_ERROR(hipHostGetDevicePointer(&DevPtr, Buffer.HostPtr, 0)); + } else { + UR_CHECK_ERROR(hipMalloc(&DevPtr, Buffer.Size)); + } + } else { + hipArray *ImageArray; + hipSurfaceObject_t Surface; + try { + auto &Image = std::get(Mem->Mem); + // Allocation has already been made + if (Image.Arrays[hDevice->getIndex()]) { + return UR_RESULT_SUCCESS; + } + UR_CHECK_ERROR(hipArray3DCreate( + reinterpret_cast(&ImageArray), &Image.ArrayDesc)); + Image.Arrays[hDevice->getIndex()] = ImageArray; + // HIP_RESOURCE_DESC is a union of different structs, shown here + // We need to fill it as described here to use it for a surface or texture + // HIP_RESOURCE_DESC::resType must be HIP_RESOURCE_TYPE_ARRAY and + // HIP_RESOURCE_DESC::res::array::hArray must be set to a valid HIP array + // handle. + // HIP_RESOURCE_DESC::flags must be set to zero + hipResourceDesc ImageResDesc; + ImageResDesc.res.array.array = ImageArray; + ImageResDesc.resType = hipResourceTypeArray; + + UR_CHECK_ERROR(hipCreateSurfaceObject(&Surface, &ImageResDesc)); + Image.SurfObjs[hDevice->getIndex()] = Surface; + } catch (ur_result_t Err) { + if (ImageArray) { + UR_CHECK_ERROR(hipFreeArray(ImageArray)); + } + return Err; + } catch (...) { + if (ImageArray) { + UR_CHECK_ERROR(hipFreeArray(ImageArray)); + } + return UR_RESULT_ERROR_UNKNOWN; + } + } + return UR_RESULT_SUCCESS; +} + +namespace { +inline ur_result_t migrateBufferToDevice(ur_mem_handle_t Mem, + ur_device_handle_t hDevice) { + auto &Buffer = std::get(Mem->Mem); + if (Mem->LastEventWritingToMemObj == nullptr) { + // Device allocation being initialized from host for the first time + if (Buffer.HostPtr) { + UR_CHECK_ERROR( + hipMemcpyHtoD(Buffer.getPtr(hDevice), Buffer.HostPtr, Buffer.Size)); + } + } else if (Mem->LastEventWritingToMemObj->getDevice() != hDevice) { + UR_CHECK_ERROR( + hipMemcpyDtoD(Buffer.getPtr(hDevice), + Buffer.getPtr(Mem->LastEventWritingToMemObj->getDevice()), + Buffer.Size)); + } + return UR_RESULT_SUCCESS; +} + +inline ur_result_t migrateImageToDevice(ur_mem_handle_t Mem, + ur_device_handle_t hDevice) { + auto &Image = std::get(Mem->Mem); + // When a dimension isn't used image_desc has the size set to 1 + size_t PixelSizeBytes = Image.PixelTypeSizeBytes * + 4; // 4 is the only number of channels we support + size_t ImageSizeBytes = PixelSizeBytes * Image.ImageDesc.width * + Image.ImageDesc.height * Image.ImageDesc.depth; + + hipArray *ImageArray = Image.getArray(hDevice); + + hip_Memcpy2D CpyDesc2D; + HIP_MEMCPY3D CpyDesc3D; + // We have to use a different copy function for each image + // dimensionality + if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE2D) { + memset(&CpyDesc2D, 0, sizeof(CpyDesc2D)); + CpyDesc2D.srcMemoryType = hipMemoryType::hipMemoryTypeHost; + CpyDesc2D.dstMemoryType = hipMemoryType::hipMemoryTypeArray; + CpyDesc2D.dstArray = reinterpret_cast(ImageArray); + CpyDesc2D.WidthInBytes = PixelSizeBytes * Image.ImageDesc.width; + CpyDesc2D.Height = Image.ImageDesc.height; + } else if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE3D) { + memset(&CpyDesc3D, 0, sizeof(CpyDesc3D)); + CpyDesc3D.srcMemoryType = hipMemoryType::hipMemoryTypeHost; + CpyDesc3D.dstMemoryType = hipMemoryType::hipMemoryTypeArray; + CpyDesc3D.dstArray = reinterpret_cast(ImageArray); + CpyDesc3D.WidthInBytes = PixelSizeBytes * Image.ImageDesc.width; + CpyDesc3D.Height = Image.ImageDesc.height; + CpyDesc3D.Depth = Image.ImageDesc.depth; + } + + if (Mem->LastEventWritingToMemObj == nullptr) { + if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE1D) { + UR_CHECK_ERROR( + hipMemcpyHtoA(ImageArray, 0, Image.HostPtr, ImageSizeBytes)); + } else if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE2D) { + CpyDesc2D.srcHost = Image.HostPtr; + UR_CHECK_ERROR(hipMemcpyParam2D(&CpyDesc2D)); + } else if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE3D) { + CpyDesc3D.srcHost = Image.HostPtr; + UR_CHECK_ERROR(hipDrvMemcpy3D(&CpyDesc3D)); + } + } else if (Mem->LastEventWritingToMemObj->getDevice() != hDevice) { + if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE1D) { + // FIXME: 1D memcpy from DtoD going through the host. + UR_CHECK_ERROR(hipMemcpyAtoH( + Image.HostPtr, + Image.getArray(Mem->LastEventWritingToMemObj->getDevice()), + 0 /*srcOffset*/, ImageSizeBytes)); + UR_CHECK_ERROR( + hipMemcpyHtoA(ImageArray, 0, Image.HostPtr, ImageSizeBytes)); + } else if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE2D) { + CpyDesc2D.srcArray = + Image.getArray(Mem->LastEventWritingToMemObj->getDevice()); + UR_CHECK_ERROR(hipMemcpyParam2D(&CpyDesc2D)); + } else if (Image.ImageDesc.type == UR_MEM_TYPE_IMAGE3D) { + CpyDesc3D.srcArray = + Image.getArray(Mem->LastEventWritingToMemObj->getDevice()); + UR_CHECK_ERROR(hipDrvMemcpy3D(&CpyDesc3D)); + } + } + return UR_RESULT_SUCCESS; +} +} // namespace + +// If calling this entry point it is necessary to lock the memoryMigrationMutex +// beforehand +ur_result_t migrateMemoryToDeviceIfNeeded(ur_mem_handle_t Mem, + const ur_device_handle_t hDevice) { + UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); + // Device allocation has already been initialized with most up to date + // data in buffer + if (Mem->HaveMigratedToDeviceSinceLastWrite[hDevice->getIndex()]) { + return UR_RESULT_SUCCESS; + } + + ScopedContext Active(hDevice); + if (Mem->isBuffer()) { + UR_CHECK_ERROR(migrateBufferToDevice(Mem, hDevice)); + } else { + UR_CHECK_ERROR(migrateImageToDevice(Mem, hDevice)); + } + + Mem->HaveMigratedToDeviceSinceLastWrite[hDevice->getIndex()] = true; + return UR_RESULT_SUCCESS; +} diff --git a/source/adapters/hip/memory.hpp b/source/adapters/hip/memory.hpp index 2732b22a6e..d36b9ee001 100644 --- a/source/adapters/hip/memory.hpp +++ b/source/adapters/hip/memory.hpp @@ -10,18 +10,25 @@ #pragma once #include "common.hpp" +#include "context.hpp" +#include "event.hpp" #include #include +ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t, + const ur_device_handle_t); +ur_result_t migrateMemoryToDeviceIfNeeded(ur_mem_handle_t, + const ur_device_handle_t); + // Handler for plain, pointer-based HIP allocations struct BufferMem { using native_type = hipDeviceptr_t; // If this allocation is a sub-buffer (i.e., a view on an existing // allocation), this is the pointer to the parent handler structure - ur_mem_handle_t Parent; - // HIP handler for the pointer - native_type Ptr; + ur_mem_handle_t Parent = nullptr; + // Outer mem holding this struct in variant + ur_mem_handle_t OuterMemStruct; /// Pointer associated with this device on the host void *HostPtr; @@ -50,20 +57,44 @@ struct BufferMem { AllocHostPtr } MemAllocMode; - BufferMem(ur_mem_handle_t Parent, AllocMode Mode, hipDeviceptr_t Ptr, - void *HostPtr, size_t Size) - : Parent{Parent}, Ptr{Ptr}, HostPtr{HostPtr}, Size{Size}, MapSize{0}, - MapOffset{0}, MapPtr{nullptr}, MapFlags{UR_MAP_FLAG_WRITE}, - MemAllocMode{Mode} {}; +private: + // Vector of HIP pointers + std::vector Ptrs; + +public: + BufferMem(ur_context_handle_t Context, ur_mem_handle_t OuterMemStruct, + AllocMode Mode, void *HostPtr, size_t Size) + : OuterMemStruct{OuterMemStruct}, HostPtr{HostPtr}, Size{Size}, + MapSize{0}, MapOffset{0}, MapPtr{nullptr}, MapFlags{UR_MAP_FLAG_WRITE}, + MemAllocMode{Mode}, Ptrs(Context->Devices.size(), native_type{0}){}; + + BufferMem(const BufferMem &Buffer) = default; - native_type get() const noexcept { return Ptr; } + // This will allocate memory on device if there isn't already an active + // allocation on the device + native_type getPtr(const ur_device_handle_t Device) { + return getPtrWithOffset(Device, 0); + } + + // This will allocate memory on device with index Index if there isn't already + // an active allocation on the device + native_type getPtrWithOffset(const ur_device_handle_t Device, size_t Offset) { + if (ur_result_t Err = + allocateMemObjOnDeviceIfNeeded(OuterMemStruct, Device); + Err != UR_RESULT_SUCCESS) { + throw Err; + } + return reinterpret_cast( + reinterpret_cast(Ptrs[Device->getIndex()]) + Offset); + } - native_type getWithOffset(size_t Offset) const noexcept { - return reinterpret_cast(reinterpret_cast(Ptr) + - Offset); + // This will allocate memory on device if there isn't already an active + // allocation on the device + void *getVoid(const ur_device_handle_t Device) { + return reinterpret_cast(getPtrWithOffset(Device, 0)); } - void *getVoid() const noexcept { return reinterpret_cast(Ptr); } + bool isSubBuffer() const noexcept { return Parent != nullptr; } size_t getSize() const noexcept { return Size; } @@ -107,28 +138,240 @@ struct BufferMem { assert(MapPtr != nullptr); return MapFlags; } + + ur_result_t clear() { + if (Parent != nullptr) { + return UR_RESULT_SUCCESS; + } + + switch (MemAllocMode) { + case AllocMode::CopyIn: + case AllocMode::Classic: + for (auto &DevPtr : Ptrs) { + if (DevPtr != native_type{0}) { + UR_CHECK_ERROR(hipFree(DevPtr)); + } + } + break; + case AllocMode::UseHostPtr: + UR_CHECK_ERROR(hipHostUnregister(HostPtr)); + break; + case AllocMode::AllocHostPtr: + UR_CHECK_ERROR(hipFreeHost(HostPtr)); + } + return UR_RESULT_SUCCESS; + } + + friend struct ur_mem_handle_t_; + friend ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t, + const ur_device_handle_t); }; // Handler data for surface object (i.e. Images) struct SurfaceMem { - hipArray *Array; - hipSurfaceObject_t SurfObj; - ur_mem_type_t ImageType; +private: + std::vector Arrays; + std::vector SurfObjs; + +public: + ur_mem_handle_t OuterMemStruct; + + ur_image_format_t ImageFormat; + ur_image_desc_t ImageDesc; + HIP_ARRAY3D_DESCRIPTOR ArrayDesc; + size_t PixelTypeSizeBytes; + void *HostPtr; + + SurfaceMem(ur_context_handle_t Context, ur_mem_handle_t OuterMemStruct, + ur_image_format_t ImageFormat, ur_image_desc_t ImageDesc, + void *HostPtr) + : Arrays(Context->Devices.size(), nullptr), + SurfObjs(Context->Devices.size(), nullptr), + OuterMemStruct{OuterMemStruct}, + ImageFormat{ImageFormat}, ImageDesc{ImageDesc}, HostPtr{HostPtr} { + // We have to use hipArray3DCreate, which has some caveats. The height and + // depth parameters must be set to 0 produce 1D or 2D arrays. image_desc + // gives a minimum value of 1, so we need to convert the answer. + ArrayDesc.NumChannels = 4; // Only support 4 channel image + ArrayDesc.Flags = 0; // No flags required + ArrayDesc.Width = ImageDesc.width; + if (ImageDesc.type == UR_MEM_TYPE_IMAGE1D) { + ArrayDesc.Height = 0; + ArrayDesc.Depth = 0; + } else if (ImageDesc.type == UR_MEM_TYPE_IMAGE2D) { + ArrayDesc.Height = ImageDesc.height; + ArrayDesc.Depth = 0; + } else if (ImageDesc.type == UR_MEM_TYPE_IMAGE3D) { + ArrayDesc.Height = ImageDesc.height; + ArrayDesc.Depth = ImageDesc.depth; + } + + // We need to get PixelTypeSizeBytes for calculating the total image size + // later + switch (ImageFormat.channelType) { + + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT8: + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT8: + ArrayDesc.Format = HIP_AD_FORMAT_UNSIGNED_INT8; + PixelTypeSizeBytes = 1; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT8: + ArrayDesc.Format = HIP_AD_FORMAT_SIGNED_INT8; + PixelTypeSizeBytes = 1; + break; + case UR_IMAGE_CHANNEL_TYPE_UNORM_INT16: + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT16: + ArrayDesc.Format = HIP_AD_FORMAT_UNSIGNED_INT16; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT16: + ArrayDesc.Format = HIP_AD_FORMAT_SIGNED_INT16; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_HALF_FLOAT: + ArrayDesc.Format = HIP_AD_FORMAT_HALF; + PixelTypeSizeBytes = 2; + break; + case UR_IMAGE_CHANNEL_TYPE_UNSIGNED_INT32: + ArrayDesc.Format = HIP_AD_FORMAT_UNSIGNED_INT32; + PixelTypeSizeBytes = 4; + break; + case UR_IMAGE_CHANNEL_TYPE_SIGNED_INT32: + ArrayDesc.Format = HIP_AD_FORMAT_SIGNED_INT32; + PixelTypeSizeBytes = 4; + break; + case UR_IMAGE_CHANNEL_TYPE_FLOAT: + ArrayDesc.Format = HIP_AD_FORMAT_FLOAT; + PixelTypeSizeBytes = 4; + break; + default: + // urMemImageCreate given unsupported image_channel_data_type + detail::ur::die("Bad image format given to ur_image_ constructor"); + } + } + + // Will allocate a new array on device if not already allocated + hipArray *getArray(const ur_device_handle_t Device) { + if (ur_result_t Err = + allocateMemObjOnDeviceIfNeeded(OuterMemStruct, Device); + Err != UR_RESULT_SUCCESS) { + throw Err; + } + return Arrays[Device->getIndex()]; + } - SurfaceMem(hipArray *Array, hipSurfaceObject_t Surf, ur_mem_type_t ImageType) - : Array{Array}, SurfObj{Surf}, ImageType{ImageType} {}; + // Will allocate a new surface on device if not already allocated + hipSurfaceObject_t getSurface(const ur_device_handle_t Device) { + if (ur_result_t Err = + allocateMemObjOnDeviceIfNeeded(OuterMemStruct, Device); + Err != UR_RESULT_SUCCESS) { + throw Err; + } + return SurfObjs[Device->getIndex()]; + } - hipArray *getArray() const noexcept { return Array; } + ur_mem_type_t getImageType() const noexcept { return ImageDesc.type; } - hipSurfaceObject_t getSurface() const noexcept { return SurfObj; } + ur_result_t clear() { + for (auto Array : Arrays) { + if (Array) { + UR_CHECK_ERROR(hipFreeArray(Array)); + } + } + for (auto Surf : SurfObjs) { + if (Surf != hipSurfaceObject_t{0}) { + UR_CHECK_ERROR(hipDestroySurfaceObject(Surf)); + } + } + return UR_RESULT_SUCCESS; + } - ur_mem_type_t getImageType() const noexcept { return ImageType; } + friend ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t, + const ur_device_handle_t); }; /// UR Mem mapping to HIP memory allocations, both data and texture/surface. /// \brief Represents non-SVM allocations on the HIP backend. /// Keeps tracks of all mapped regions used for Map/Unmap calls. /// Only one region can be active at the same time per allocation. +/// +/// The ur_mem_handle_t is responsible for memory allocation and migration +/// across devices in the same ur_context_handle_t. If a kernel writes to a +/// ur_mem_handle_t then it will write to LastEventWritingToMemObj. Then all +/// subsequent operations that want to read from the ur_mem_handle_t must wait +/// on the event referring to the last write. +/// +/// Since urMemBufferCreate/urMemImageCreate do not take a queue or device +/// object, only a ur_context_handle_t, at mem obj creation we don't know which +/// device we must make a native image/allocation on. Therefore no allocations +/// are made at urMemBufferCreate/urMemImageCreate. Instead device +/// images/allocations are made lazily. These allocations are made implicitly +/// with a call to getPtr/getArray which will allocate a new allocation/image on +/// device if need be. +/// +/// Memory migration between native allocations for devices in the same +/// ur_context_handle_t will occur at: +/// +/// 1. urEnqueueKernelLaunch +/// 2. urEnqueueMem(Buffer|Image)Read(Rect) +/// +/// Migrations will occur in both cases if the most recent version of data +/// is on a different device, marked by LastEventWritingToMemObj->getDevice(). +/// +/// Example trace: +/// ~~~~~~~~~~~~~~ +/// +/// =====> urContextCreate([device0, device1], ...) // associated with [q0, q1] +/// -> OUT: hContext +/// +/// =====> urMemBufferCreate(hContext,...); +/// -> No native allocations made +/// -> OUT: hBuffer +/// +/// =====> urEnqueueMemBufferWrite(q0, hBuffer,...); +/// -> Allocation made on q0 ie device0 +/// -> New allocation initialized with host data. +/// +/// =====> urKernelSetArgMemObj(hKernel0, hBuffer, ...); +/// -> ur_kernel_handle_t associated with a ur_program_handle_t, +/// which is in turn unique to a device. So we can set the kernel +/// arg with the ptr of the device specific allocation. +/// -> hKernel0->getProgram()->getDevice() == device0 +/// -> allocateMemObjOnDeviceIfNeeded(device0); +/// -> Native allocation already made on device0, continue. +/// +/// =====> urEnqueueKernelLaunch(q0, hKernel0, ...); +/// -> Suppose that hKernel0 writes to hBuffer. +/// -> Call hBuffer->setLastEventWritingToMemObj with return event +/// from this operation +/// -> Enqueue native kernel launch +/// +/// =====> urKernelSetArgMemObj(hKernel1, hBuffer, ...); +/// -> hKernel1->getProgram()->getDevice() == device1 +/// -> New allocation will be made on device1 when calling +/// getPtr(device1) +/// -> No native allocation on device1 +/// -> Make native allocation on device1 +/// +/// =====> urEnqueueKernelLaunch(q1, hKernel1, ...); +/// -> Suppose hKernel1 wants to read from hBuffer and not write. +/// -> migrateMemoryToDeviceIfNeeded(device1); +/// -> hBuffer->LastEventWritingToMemObj is not nullptr +/// -> Check if memory has been migrated to device1 since the +/// last write +/// -> Hasn't been migrated +/// -> Wait on LastEventWritingToMemObj. +/// -> Migrate memory from device0's native allocation to +/// device1's native allocation. +/// -> Enqueue native kernel launch +/// +/// =====> urEnqueueKernelLaunch(q0, hKernel0, ...); +/// -> migrateMemoryToDeviceIfNeeded(device0); +/// -> hBuffer->LastEventWritingToMemObj refers to an event +/// from q0 +/// -> Migration not necessary +/// -> Enqueue native kernel launch +/// struct ur_mem_handle_t_ { // TODO: Move as much shared data up as possible @@ -140,36 +383,76 @@ struct ur_mem_handle_t_ { /// Reference counting of the handler std::atomic_uint32_t RefCount; - enum class Type { Buffer, Surface } MemType; // Original mem flags passed ur_mem_flags_t MemFlags; + // If we make a ur_mem_handle_t_ from a native allocation, it can be useful to + // associate it with the device that holds the native allocation. + ur_device_handle_t DeviceWithNativeAllocation{nullptr}; + + // Has the memory been migrated to a device since the last write? + std::vector HaveMigratedToDeviceSinceLastWrite; + + // We should wait on this event prior to migrating memory across allocations + // in this ur_mem_handle_t_ + ur_event_handle_t LastEventWritingToMemObj{nullptr}; + + // Enumerates all possible types of accesses. + enum access_mode_t { unknown, read_write, read_only, write_only }; + + ur_mutex MemoryAllocationMutex; // A mutex for allocations + ur_mutex MemoryMigrationMutex; // A mutex for memory transfers + /// A UR Memory object represents either plain memory allocations ("Buffers" /// in OpenCL) or typed allocations ("Images" in OpenCL). /// In HIP their API handlers are different. Whereas "Buffers" are allocated /// as pointer-like structs, "Images" are stored in Textures or Surfaces. - /// This union allows implementation to use either from the same handler. + /// This variant allows implementation to use either from the same handler. std::variant Mem; - /// Constructs the UR MEM handler for a non-typed allocation ("buffer") - ur_mem_handle_t_(ur_context Ctxt, ur_mem Parent, ur_mem_flags_t MemFlags, - BufferMem::AllocMode Mode, hipDeviceptr_t Ptr, void *HostPtr, - size_t Size) - : Context{Ctxt}, RefCount{1}, MemType{Type::Buffer}, MemFlags{MemFlags}, - Mem{BufferMem{Parent, Mode, Ptr, HostPtr, Size}} { - if (isSubBuffer()) { - urMemRetain(std::get(Mem).Parent); - } else { - urContextRetain(Context); + /// Constructs the UR mem handler for a non-typed allocation ("buffer") + ur_mem_handle_t_(ur_context_handle_t Ctxt, ur_mem_flags_t MemFlags, + BufferMem::AllocMode Mode, void *HostPtr, size_t Size) + : Context{Ctxt}, RefCount{1}, MemFlags{MemFlags}, + HaveMigratedToDeviceSinceLastWrite(Context->Devices.size(), false), + Mem{std::in_place_type, Ctxt, this, Mode, HostPtr, Size} { + urContextRetain(Context); + }; + + // Subbuffer constructor + ur_mem_handle_t_(ur_mem Parent, size_t SubBufferOffset) + : Context{Parent->Context}, RefCount{1}, MemFlags{Parent->MemFlags}, + HaveMigratedToDeviceSinceLastWrite(Parent->Context->Devices.size(), + false), + Mem{BufferMem{std::get(Parent->Mem)}} { + auto &SubBuffer = std::get(Mem); + SubBuffer.Parent = Parent; + SubBuffer.OuterMemStruct = this; + if (SubBuffer.HostPtr) { + SubBuffer.HostPtr = + static_cast(SubBuffer.HostPtr) + SubBufferOffset; + } + for (auto &DevPtr : SubBuffer.Ptrs) { + if (DevPtr) { + DevPtr = static_cast(DevPtr) + SubBufferOffset; + } } + urMemRetain(Parent); }; - /// Constructs the UR allocation for an Image object - ur_mem_handle_t_(ur_context Ctxt, hipArray *Array, hipSurfaceObject_t Surf, - ur_mem_flags_t MemFlags, ur_mem_type_t ImageType, void *) - : Context{Ctxt}, RefCount{1}, MemType{Type::Surface}, MemFlags{MemFlags}, - Mem{SurfaceMem{Array, Surf, ImageType}} { + /// Constructs the UR mem handler for an Image object + ur_mem_handle_t_(ur_context Ctxt, ur_mem_flags_t MemFlags, + ur_image_format_t ImageFormat, ur_image_desc_t ImageDesc, + void *HostPtr) + : Context{Ctxt}, RefCount{1}, MemFlags{MemFlags}, + HaveMigratedToDeviceSinceLastWrite(Context->Devices.size(), false), + Mem{std::in_place_type, + Ctxt, + this, + ImageFormat, + ImageDesc, + HostPtr} { urContextRetain(Context); } @@ -181,13 +464,24 @@ struct ur_mem_handle_t_ { urContextRelease(Context); } - bool isBuffer() const noexcept { return MemType == Type::Buffer; } + bool isBuffer() const noexcept { + return std::holds_alternative(Mem); + } bool isSubBuffer() const noexcept { return (isBuffer() && (std::get(Mem).Parent != nullptr)); } - bool isImage() const noexcept { return MemType == Type::Surface; } + bool isImage() const noexcept { + return std::holds_alternative(Mem); + } + + ur_result_t clear() { + if (isBuffer()) { + return std::get(Mem).clear(); + } + return std::get(Mem).clear(); + } ur_context getContext() const noexcept { return Context; } @@ -196,4 +490,19 @@ struct ur_mem_handle_t_ { uint32_t decrementReferenceCount() noexcept { return --RefCount; } uint32_t getReferenceCount() const noexcept { return RefCount; } + + void setLastEventWritingToMemObj(ur_event_handle_t NewEvent) { + assert(NewEvent && "Invalid event!"); + // This entry point should only ever be called when using multi device ctx + assert(Context->Devices.size() > 1); + if (LastEventWritingToMemObj != nullptr) { + urEventRelease(LastEventWritingToMemObj); + } + urEventRetain(NewEvent); + LastEventWritingToMemObj = NewEvent; + for (const auto &Device : Context->getDevices()) { + HaveMigratedToDeviceSinceLastWrite[Device->getIndex()] = + Device == NewEvent->getDevice(); + } + } }; diff --git a/source/adapters/hip/platform.cpp b/source/adapters/hip/platform.cpp index 5f35b55f1f..287f941c30 100644 --- a/source/adapters/hip/platform.cpp +++ b/source/adapters/hip/platform.cpp @@ -47,9 +47,6 @@ urPlatformGetInfo(ur_platform_handle_t, ur_platform_info_t propName, /// There is only one HIP platform, and contains all devices on the system. /// Triggers the HIP Driver initialization (hipInit) the first time, so this /// must be the first UR API called. -/// -/// However because multiple devices in a context is not currently supported, -/// place each device in a separate platform. UR_APIEXPORT ur_result_t UR_APICALL urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, ur_platform_handle_t *phPlatforms, uint32_t *pNumPlatforms) { @@ -57,7 +54,7 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, try { static std::once_flag InitFlag; static uint32_t NumPlatforms = 1; - static std::vector PlatformIds; + static ur_platform_handle_t_ Platform; UR_ASSERT(phPlatforms || pNumPlatforms, UR_RESULT_ERROR_INVALID_VALUE); UR_ASSERT(!phPlatforms || NumEntries > 0, UR_RESULT_ERROR_INVALID_VALUE); @@ -79,22 +76,18 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, return; } try { - // make one platform per device - NumPlatforms = NumDevices; - PlatformIds.resize(NumDevices); - - for (int i = 0; i < NumDevices; ++i) { + for (auto i = 0u; i < static_cast(NumDevices); ++i) { hipDevice_t Device; UR_CHECK_ERROR(hipDeviceGet(&Device, i)); hipCtx_t Context; UR_CHECK_ERROR(hipDevicePrimaryCtxRetain(&Context, Device)); - PlatformIds[i].Devices.emplace_back( - new ur_device_handle_t_{Device, Context, &PlatformIds[i]}); + Platform.Devices.emplace_back( + new ur_device_handle_t_{Device, Context, &Platform, i}); } // Setup EvBase { - ScopedContext Active(PlatformIds.front().Devices.front().get()); + ScopedContext Active(Platform.Devices.front().get()); hipEvent_t EvBase; UR_CHECK_ERROR(hipEventCreate(&EvBase)); UR_CHECK_ERROR(hipEventRecord(EvBase, 0)); @@ -103,17 +96,11 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, } } catch (const std::bad_alloc &) { // Signal out-of-memory situation - for (int i = 0; i < NumDevices; ++i) { - PlatformIds[i].Devices.clear(); - } - PlatformIds.clear(); + Platform.Devices.clear(); Err = UR_RESULT_ERROR_OUT_OF_HOST_MEMORY; } catch (ur_result_t CatchErr) { // Clear and rethrow to allow retry - for (int i = 0; i < NumDevices; ++i) { - PlatformIds[i].Devices.clear(); - } - PlatformIds.clear(); + Platform.Devices.clear(); Err = CatchErr; throw CatchErr; } catch (...) { @@ -128,9 +115,7 @@ urPlatformGet(ur_adapter_handle_t *, uint32_t, uint32_t NumEntries, } if (phPlatforms != nullptr) { - for (unsigned i = 0; i < std::min(NumEntries, NumPlatforms); ++i) { - phPlatforms[i] = &PlatformIds[i]; - } + *phPlatforms = &Platform; } return Result; diff --git a/source/adapters/hip/program.cpp b/source/adapters/hip/program.cpp index 2c71c53208..0cf539602b 100644 --- a/source/adapters/hip/program.cpp +++ b/source/adapters/hip/program.cpp @@ -74,14 +74,6 @@ void getCoMgrBuildLog(const amd_comgr_data_set_t BuildDataSet, char *BuildLog, } // namespace #endif -ur_program_handle_t_::ur_program_handle_t_(ur_context_handle_t Ctxt) - : Module{nullptr}, Binary{}, BinarySizeInBytes{0}, RefCount{1}, Context{ - Ctxt} { - urContextRetain(Context); -} - -ur_program_handle_t_::~ur_program_handle_t_() { urContextRelease(Context); } - ur_result_t ur_program_handle_t_::setMetadata(const ur_program_metadata_t *Metadata, size_t Length) { @@ -135,8 +127,8 @@ ur_result_t ur_program_handle_t_::finalizeRelocatable() { std::string ISA = "amdgcn-amd-amdhsa--"; hipDeviceProp_t Props; - detail::ur::assertion(hipGetDeviceProperties( - &Props, Context->getDevice()->get()) == hipSuccess); + detail::ur::assertion(hipGetDeviceProperties(&Props, getDevice()->get()) == + hipSuccess); ISA += Props.gcnArchName; UR_CHECK_ERROR(amd_comgr_action_info_set_isa_name(Action, ISA.data())); @@ -222,18 +214,13 @@ ur_result_t getKernelNames(ur_program_handle_t) { return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } -/// HIP will handle the PTX/HIPBIN binaries internally through hipModule_t -/// object. So, urProgramCreateWithIL and urProgramCreateWithBinary are -/// equivalent in terms of HIP adapter. See \ref urProgramCreateWithBinary. +/// A program must be specific to a device so this entry point is UNSUPPORTED UR_APIEXPORT ur_result_t UR_APICALL -urProgramCreateWithIL(ur_context_handle_t hContext, const void *pIL, - size_t length, const ur_program_properties_t *pProperties, - ur_program_handle_t *phProgram) { - ur_device_handle_t hDevice = hContext->getDevice(); - const auto pBinary = reinterpret_cast(pIL); - - return urProgramCreateWithBinary(hContext, hDevice, length, pBinary, - pProperties, phProgram); +urProgramCreateWithIL(ur_context_handle_t, const void *, size_t, + const ur_program_properties_t *, ur_program_handle_t *) { + detail::ur::die("urProgramCreateWithIL not implemented for HIP adapter" + " please use urProgramCreateWithBinary instead"); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; } /// HIP will handle the PTX/HIPBIN binaries internally through a call to @@ -268,7 +255,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramBuild(ur_context_handle_t, ur_result_t Result = UR_RESULT_SUCCESS; try { - ScopedContext Active(hProgram->getContext()->getDevice()); + ScopedContext Active(hProgram->getDevice()); hProgram->buildProgram(pOptions); @@ -340,7 +327,7 @@ urProgramGetInfo(ur_program_handle_t hProgram, ur_program_info_t propName, case UR_PROGRAM_INFO_NUM_DEVICES: return ReturnValue(1u); case UR_PROGRAM_INFO_DEVICES: - return ReturnValue(&hProgram->Context->DeviceId, 1); + return ReturnValue(hProgram->getDevice(), 1); case UR_PROGRAM_INFO_SOURCE: return ReturnValue(hProgram->Binary); case UR_PROGRAM_INFO_BINARY_SIZES: @@ -380,7 +367,7 @@ urProgramRelease(ur_program_handle_t hProgram) { ur_result_t Result = UR_RESULT_ERROR_INVALID_PROGRAM; try { - ScopedContext Active(hProgram->getContext()->getDevice()); + ScopedContext Active(hProgram->getDevice()); auto HIPModule = hProgram->get(); if (HIPModule) { UR_CHECK_ERROR(hipModuleUnload(HIPModule)); @@ -422,13 +409,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithBinary( const uint8_t *pBinary, const ur_program_properties_t *pProperties, ur_program_handle_t *phProgram) { UR_ASSERT(pBinary != nullptr && size != 0, UR_RESULT_ERROR_INVALID_BINARY); - UR_ASSERT(hContext->getDevice()->get() == hDevice->get(), + UR_ASSERT(std::find(hContext->getDevices().begin(), + hContext->getDevices().end(), + hDevice) != hContext->getDevices().end(), UR_RESULT_ERROR_INVALID_CONTEXT); ur_result_t Result = UR_RESULT_SUCCESS; std::unique_ptr RetProgram{ - new ur_program_handle_t_{hContext}}; + new ur_program_handle_t_{hContext, hDevice}}; // TODO: Set metadata here and use reqd_work_group_size information. // See urProgramCreateWithBinary in CUDA adapter. @@ -469,8 +458,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer( ur_device_handle_t hDevice, ur_program_handle_t hProgram, const char *pFunctionName, void **ppFunctionPointer) { // Check if device passed is the same the device bound to the context - UR_ASSERT(hDevice == hProgram->getContext()->getDevice(), - UR_RESULT_ERROR_INVALID_DEVICE); + UR_ASSERT(hDevice == hProgram->getDevice(), UR_RESULT_ERROR_INVALID_DEVICE); hipFunction_t Func; hipError_t Ret = hipModuleGetFunction(&Func, hProgram->get(), pFunctionName); diff --git a/source/adapters/hip/program.hpp b/source/adapters/hip/program.hpp index ff9b68fc92..4b4e5ec878 100644 --- a/source/adapters/hip/program.hpp +++ b/source/adapters/hip/program.hpp @@ -23,6 +23,7 @@ struct ur_program_handle_t_ { size_t BinarySizeInBytes; std::atomic_uint32_t RefCount; ur_context_handle_t Context; + ur_device_handle_t Device; std::string ExecutableCache; // Metadata @@ -34,8 +35,17 @@ struct ur_program_handle_t_ { std::string BuildOptions; ur_program_build_status_t BuildStatus = UR_PROGRAM_BUILD_STATUS_NONE; - ur_program_handle_t_(ur_context_handle_t Ctxt); - ~ur_program_handle_t_(); + ur_program_handle_t_(ur_context_handle_t Ctxt, ur_device_handle_t Device) + : Module{nullptr}, Binary{}, + BinarySizeInBytes{0}, RefCount{1}, Context{Ctxt}, Device{Device} { + urContextRetain(Context); + urDeviceRetain(Device); + } + + ~ur_program_handle_t_() { + urContextRelease(Context); + urDeviceRelease(Device); + } ur_result_t setMetadata(const ur_program_metadata_t *Metadata, size_t Length); @@ -44,6 +54,7 @@ struct ur_program_handle_t_ { ur_result_t buildProgram(const char *BuildOptions); ur_result_t finalizeRelocatable(); ur_context_handle_t getContext() const { return Context; }; + ur_device_handle_t getDevice() const { return Device; }; native_type get() const noexcept { return Module; }; diff --git a/source/adapters/hip/queue.cpp b/source/adapters/hip/queue.cpp index 910d7cf512..f01fc0e180 100644 --- a/source/adapters/hip/queue.cpp +++ b/source/adapters/hip/queue.cpp @@ -110,14 +110,13 @@ hipStream_t ur_queue_handle_t_::getNextTransferStream() { UR_APIEXPORT ur_result_t UR_APICALL urQueueCreate(ur_context_handle_t hContext, ur_device_handle_t hDevice, const ur_queue_properties_t *pProps, ur_queue_handle_t *phQueue) { + UR_ASSERT(std::find(hContext->getDevices().begin(), + hContext->getDevices().end(), + hDevice) != hContext->getDevices().end(), + UR_RESULT_ERROR_INVALID_CONTEXT); try { std::unique_ptr QueueImpl{nullptr}; - if (hContext->getDevice() != hDevice) { - *phQueue = nullptr; - return UR_RESULT_ERROR_INVALID_DEVICE; - } - unsigned int Flags = 0; const bool IsOutOfOrder = @@ -198,7 +197,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueRelease(ur_queue_handle_t hQueue) { if (!hQueue->backendHasOwnership()) return UR_RESULT_SUCCESS; - ScopedContext Active(hQueue->getContext()->getDevice()); + ScopedContext Active(hQueue->getDevice()); hQueue->forEachStream([](hipStream_t S) { UR_CHECK_ERROR(hipStreamSynchronize(S)); @@ -219,7 +218,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueFinish(ur_queue_handle_t hQueue) { try { - ScopedContext Active(hQueue->getContext()->getDevice()); + ScopedContext Active(hQueue->getDevice()); hQueue->syncStreams([&Result](hipStream_t S) { UR_CHECK_ERROR(hipStreamSynchronize(S)); @@ -251,7 +250,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueFlush(ur_queue_handle_t) { UR_APIEXPORT ur_result_t UR_APICALL urQueueGetNativeHandle(ur_queue_handle_t hQueue, ur_queue_native_desc_t *, ur_native_handle_t *phNativeQueue) { - ScopedContext Active(hQueue->getContext()->getDevice()); + ScopedContext Active(hQueue->getDevice()); *phNativeQueue = reinterpret_cast(hQueue->getNextComputeStream()); return UR_RESULT_SUCCESS; @@ -291,7 +290,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urQueueCreateWithNativeHandle( new ur_queue_handle_t_{std::move(ComputeHIPStreams), std::move(TransferHIPStreams), hContext, - hContext->getDevice(), + hDevice, HIPFlags, Flags, /*backend_owns*/ pProperties->isNativeHandleOwned}; diff --git a/source/adapters/hip/usm.cpp b/source/adapters/hip/usm.cpp index 7af7401f87..458e985a29 100644 --- a/source/adapters/hip/usm.cpp +++ b/source/adapters/hip/usm.cpp @@ -70,7 +70,6 @@ UR_APIEXPORT ur_result_t UR_APICALL USMFreeImpl(ur_context_handle_t hContext, void *pMem) { ur_result_t Result = UR_RESULT_SUCCESS; try { - ScopedContext Active(hContext->getDevice()); hipPointerAttribute_t hipPointerAttributeType; UR_CHECK_ERROR(hipPointerGetAttributes(&hipPointerAttributeType, pMem)); unsigned int Type = hipPointerAttributeType.memoryType; @@ -98,12 +97,12 @@ UR_APIEXPORT ur_result_t UR_APICALL urUSMFree(ur_context_handle_t hContext, } } -ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t Context, - ur_device_handle_t, ur_usm_device_mem_flags_t *, - size_t Size, +ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t, + ur_device_handle_t Device, + ur_usm_device_mem_flags_t *, size_t Size, [[maybe_unused]] uint32_t Alignment) { try { - ScopedContext Active(Context->getDevice()); + ScopedContext Active(Device); UR_CHECK_ERROR(hipMalloc(ResultPtr, Size)); } catch (ur_result_t Err) { return Err; @@ -113,12 +112,13 @@ ur_result_t USMDeviceAllocImpl(void **ResultPtr, ur_context_handle_t Context, return UR_RESULT_SUCCESS; } -ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t Context, - ur_device_handle_t, ur_usm_host_mem_flags_t *, +ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t, + ur_device_handle_t Device, + ur_usm_host_mem_flags_t *, ur_usm_device_mem_flags_t *, size_t Size, [[maybe_unused]] uint32_t Alignment) { try { - ScopedContext Active(Context->getDevice()); + ScopedContext Active(Device); UR_CHECK_ERROR(hipMallocManaged(ResultPtr, Size, hipMemAttachGlobal)); } catch (ur_result_t Err) { return Err; @@ -132,7 +132,6 @@ ur_result_t USMHostAllocImpl(void **ResultPtr, ur_context_handle_t Context, ur_usm_host_mem_flags_t *, size_t Size, [[maybe_unused]] uint32_t Alignment) { try { - ScopedContext Active(Context->getDevice()); UR_CHECK_ERROR(hipHostMalloc(ResultPtr, Size)); } catch (ur_result_t Err) { return Err; @@ -152,7 +151,6 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem, UrReturnHelper ReturnValue(propValueSize, pPropValue, pPropValueSizeRet); try { - ScopedContext Active(hContext->getDevice()); switch (propName) { case UR_USM_ALLOC_INFO_TYPE: { unsigned int Value; @@ -346,25 +344,26 @@ ur_usm_pool_handle_t_::ur_usm_pool_handle_t_(ur_context_handle_t Context, this->DisjointPoolConfigs.Configs[usm::DisjointPoolMemType::Host]) .second; - auto Device = Context->DeviceId; - MemProvider = - umf::memoryProviderMakeUnique(Context, Device) - .second; - DeviceMemPool = - umf::poolMakeUnique( - {std::move(MemProvider)}, - this->DisjointPoolConfigs.Configs[usm::DisjointPoolMemType::Device]) - .second; - - MemProvider = - umf::memoryProviderMakeUnique(Context, Device) - .second; - SharedMemPool = - umf::poolMakeUnique( - {std::move(MemProvider)}, - this->DisjointPoolConfigs.Configs[usm::DisjointPoolMemType::Shared]) - .second; - Context->addPool(this); + for (const auto &Device : Context->getDevices()) { + MemProvider = + umf::memoryProviderMakeUnique(Context, Device) + .second; + DeviceMemPool = + umf::poolMakeUnique( + {std::move(MemProvider)}, + this->DisjointPoolConfigs.Configs[usm::DisjointPoolMemType::Device]) + .second; + + MemProvider = + umf::memoryProviderMakeUnique(Context, Device) + .second; + SharedMemPool = + umf::poolMakeUnique( + {std::move(MemProvider)}, + this->DisjointPoolConfigs.Configs[usm::DisjointPoolMemType::Shared]) + .second; + Context->addPool(this); + } } bool ur_usm_pool_handle_t_::hasUMFPool(umf_memory_pool_t *umf_pool) { diff --git a/source/ur/ur.hpp b/source/ur/ur.hpp index 0437d719ba..da5ef0d81f 100644 --- a/source/ur/ur.hpp +++ b/source/ur/ur.hpp @@ -106,6 +106,7 @@ class ur_shared_mutex { // nop. class ur_mutex { std::mutex Mutex; + friend class ur_lock; public: void lock() { @@ -121,6 +122,17 @@ class ur_mutex { } }; +class ur_lock { + std::unique_lock Lock; + +public: + explicit ur_lock(ur_mutex &Mutex) { + if (!SingleThreadMode) { + Lock = std::unique_lock(Mutex.Mutex); + } + } +}; + /// SpinLock is a synchronization primitive, that uses atomic variable and /// causes thread trying acquire lock wait in loop while repeatedly check if /// the lock is available. diff --git a/test/adapters/hip/test_context.cpp b/test/adapters/hip/test_context.cpp index 90c28b842f..c58dfc5af7 100644 --- a/test/adapters/hip/test_context.cpp +++ b/test/adapters/hip/test_context.cpp @@ -28,7 +28,9 @@ TEST_P(urHipContextTest, ActiveContexts) { hipCtx_t hipContext = nullptr; ASSERT_SUCCESS_HIP(hipCtxGetCurrent(&hipContext)); ASSERT_NE(hipContext, nullptr); - ASSERT_EQ(hipContext, context->getDevice()->getNativeContext()); + if (context->getDevices().size() == 1) { + ASSERT_EQ(hipContext, context->getDevices()[0]->getNativeContext()); + } ASSERT_SUCCESS(urQueueRelease(queue)); ASSERT_SUCCESS(urContextRelease(context)); @@ -60,7 +62,9 @@ TEST_P(urHipContextTest, ActiveContextsThreads) { // check that the first context is now the active HIP context ASSERT_SUCCESS_HIP(hipCtxGetCurrent(¤t)); - ASSERT_EQ(current, context1->getDevice()->getNativeContext()); + if (context1->getDevices().size() == 1) { + ASSERT_EQ(current, context1->getDevices()[0]->getNativeContext()); + } ASSERT_SUCCESS(urQueueRelease(queue)); @@ -87,7 +91,9 @@ TEST_P(urHipContextTest, ActiveContextsThreads) { // check that the second context is now the active HIP context ASSERT_SUCCESS_HIP(hipCtxGetCurrent(¤t)); - ASSERT_EQ(current, context2->getDevice()->getNativeContext()); + if (context2->getDevices().size() == 1) { + ASSERT_EQ(current, context2->getDevices()[0]->getNativeContext()); + } ASSERT_SUCCESS(urQueueRelease(queue)); }); diff --git a/test/conformance/context/context_adapter_hip.match b/test/conformance/context/context_adapter_hip.match index 129b8d392c..82d8d71397 100644 --- a/test/conformance/context/context_adapter_hip.match +++ b/test/conformance/context/context_adapter_hip.match @@ -1 +1,2 @@ urContextCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}}_ +urContextGetInfoTestWithInfoParam.Success/AMD_HIP_BACKEND___{{.*}} diff --git a/test/conformance/memory/memory_adapter_hip.match b/test/conformance/memory/memory_adapter_hip.match index a4ae7d4f8a..02760dcb8a 100644 --- a/test/conformance/memory/memory_adapter_hip.match +++ b/test/conformance/memory/memory_adapter_hip.match @@ -1,5 +1,7 @@ -urMemBufferCreateWithNativeHandleTest.Success/AMD_HIP_BACKEND___{{.*}}_ -{{OPT}}urMemImageCreateTest.InvalidSize/AMD_HIP_BACKEND___{{.*}}_ -{{OPT}}urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_IMAGE_INFO_ROW_PITCH -{{OPT}}urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_IMAGE_INFO_SLICE_PITCH -{{OPT}}Segmentation fault +{{OPT}}urMemGetInfoTest.InvalidNullPointerParamValue/AMD_HIP_BACKEND___{{.*}} +{{OPT}}urMemGetInfoTest.InvalidNullPointerParamValue/AMD_HIP_BACKEND___{{.*}} +{{OPT}}urMemGetInfoTest.InvalidNullPointerPropSizeRet/AMD_HIP_BACKEND___{{.*}} +{{OPT}}urMemGetInfoTest.InvalidNullPointerPropSizeRet/AMD_HIP_BACKEND___{{.*}} +{{OPT}}urMemImageCreateTest.InvalidSize/AMD_HIP_BACKEND___{{.*}} +{{OPT}}urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} +{{OPT}}urMemImageGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}} From f0e0be2471ebc26bebc02845801a63b8173de9c3 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Mon, 4 Dec 2023 13:56:54 +0000 Subject: [PATCH 139/145] [HIP] Fix unused parameter warnings --- source/adapters/hip/usm.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/adapters/hip/usm.cpp b/source/adapters/hip/usm.cpp index 458e985a29..334e0a86c1 100644 --- a/source/adapters/hip/usm.cpp +++ b/source/adapters/hip/usm.cpp @@ -66,8 +66,8 @@ urUSMSharedAlloc(ur_context_handle_t hContext, ur_device_handle_t hDevice, return umfPoolMallocHelper(hPool, ppMem, size, alignment); } -UR_APIEXPORT ur_result_t UR_APICALL USMFreeImpl(ur_context_handle_t hContext, - void *pMem) { +UR_APIEXPORT ur_result_t UR_APICALL +USMFreeImpl([[maybe_unused]] ur_context_handle_t hContext, void *pMem) { ur_result_t Result = UR_RESULT_SUCCESS; try { hipPointerAttribute_t hipPointerAttributeType; @@ -128,7 +128,8 @@ ur_result_t USMSharedAllocImpl(void **ResultPtr, ur_context_handle_t, return UR_RESULT_SUCCESS; } -ur_result_t USMHostAllocImpl(void **ResultPtr, ur_context_handle_t Context, +ur_result_t USMHostAllocImpl(void **ResultPtr, + [[maybe_unused]] ur_context_handle_t Context, ur_usm_host_mem_flags_t *, size_t Size, [[maybe_unused]] uint32_t Alignment) { try { From 4b7f70f264ad093b45c40aed21f0c887128a691a Mon Sep 17 00:00:00 2001 From: Aaron Greig Date: Thu, 16 Nov 2023 17:19:20 +0000 Subject: [PATCH 140/145] Add bounds checking for enqueue operations to the validation layer. This is accomplished with the various size queries for buffers, images and USM allocations. Since not all adapters have these queries implemented the bounds checking isn't entirely comprehensive on all platforms just yet. --- include/ur_api.h | 49 ++--- include/ur_print.hpp | 4 +- scripts/YaML.md | 7 +- scripts/core/enqueue.yml | 46 ++-- scripts/parse_specs.py | 9 + scripts/templates/helper.py | 61 +++++- source/adapters/hip/usm.cpp | 6 +- source/adapters/null/ur_nullddi.cpp | 90 +++++--- source/adapters/opencl/enqueue.cpp | 176 +++------------ source/loader/layers/tracing/ur_trcddi.cpp | 92 +++++--- source/loader/layers/validation/ur_valddi.cpp | 202 +++++++++++++++--- .../layers/validation/ur_validation_layer.cpp | 125 +++++++++++ .../layers/validation/ur_validation_layer.hpp | 11 + source/loader/ur_ldrddi.cpp | 90 +++++--- source/loader/ur_libapi.cpp | 92 +++++--- source/ur_api.cpp | 90 +++++--- 16 files changed, 747 insertions(+), 403 deletions(-) diff --git a/include/ur_api.h b/include/ur_api.h index 09f6d77a6b..63f5fc8083 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -5972,7 +5972,7 @@ urEnqueueEventsWaitWithBarrier( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -6021,7 +6021,7 @@ urEnqueueMemBufferRead( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being written @@ -6080,7 +6080,7 @@ urEnqueueMemBufferWrite( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -6146,7 +6146,7 @@ urEnqueueMemBufferReadRect( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -6199,8 +6199,8 @@ urEnqueueMemBufferWriteRect( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_mem_handle_t hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -6252,8 +6252,8 @@ urEnqueueMemBufferCopy( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_mem_handle_t hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t region, ///< [in] source 3D rectangular region descriptor: width, height, depth @@ -6307,7 +6307,7 @@ urEnqueueMemBufferCopyRect( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object const void *pPattern, ///< [in] pointer to the fill pattern size_t patternSize, ///< [in] size in bytes of the pattern size_t offset, ///< [in] offset into the buffer @@ -6357,7 +6357,7 @@ urEnqueueMemBufferFill( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image ur_rect_region_t region, ///< [in] defines the (width, height, depth) in pixels of the 1D, 2D, or 3D @@ -6410,7 +6410,7 @@ urEnqueueMemImageRead( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image ur_rect_region_t region, ///< [in] defines the (width, height, depth) in pixels of the 1D, 2D, or 3D @@ -6457,8 +6457,8 @@ urEnqueueMemImageWrite( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_mem_handle_t hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image ur_rect_offset_t dstOrigin, ///< [in] defines the (x,y,z) offset in pixels in the destination 1D, 2D, @@ -6543,7 +6543,7 @@ typedef enum ur_usm_migration_flag_t { UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -6611,7 +6611,7 @@ urEnqueueMemUnmap( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == ptr` +/// + `NULL == pMem` /// + `NULL == pPattern` /// - ::UR_RESULT_ERROR_INVALID_QUEUE /// - ::UR_RESULT_ERROR_INVALID_EVENT @@ -6631,7 +6631,7 @@ urEnqueueMemUnmap( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. const void *pPattern, ///< [in] pointer with the bytes of the pattern to set. @@ -6674,8 +6674,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object + void *pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void *pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t *phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -6720,7 +6720,7 @@ urEnqueueUSMMemcpy( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMPrefetch( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object + const void *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list @@ -6762,7 +6762,7 @@ urEnqueueUSMPrefetch( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMAdvise( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object + const void *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t *phEvent ///< [out][optional] return an event object that identifies this particular @@ -6803,7 +6803,7 @@ urEnqueueUSMAdvise( UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void *pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -6853,9 +6853,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void *pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void *pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. size_t height, ///< [in] the height of columns to be copied. @@ -9856,7 +9857,7 @@ typedef struct ur_enqueue_mem_unmap_params_t { /// allowing the callback the ability to modify the parameter's value typedef struct ur_enqueue_usm_fill_params_t { ur_queue_handle_t *phQueue; - void **pptr; + void **ppMem; size_t *ppatternSize; const void **ppPattern; size_t *psize; diff --git a/include/ur_print.hpp b/include/ur_print.hpp index dc7442068c..9a0ce9e657 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -12512,10 +12512,10 @@ inline std::ostream &operator<<(std::ostream &os, [[maybe_unused]] const struct *(params->phQueue)); os << ", "; - os << ".ptr = "; + os << ".pMem = "; ur::details::printPtr(os, - *(params->pptr)); + *(params->ppMem)); os << ", "; os << ".patternSize = "; diff --git a/scripts/YaML.md b/scripts/YaML.md index 291e4263c7..ee22cd39d6 100644 --- a/scripts/YaML.md +++ b/scripts/YaML.md @@ -616,13 +616,18 @@ class ur_name_t(Structure): - `out` is used for params that are write-only; if the param is a pointer, then the memory being pointed to is also write-only - `in,out` is used for params that are both read and write; typically this is used for pointers to other data structures that contain both read and write params - `nocheck` is used to specify that no additional validation checks will be generated. - + `desc` may include one the following annotations: {`"[optional]"`, `"[range(start,end)]"`, `"[release]"`, `"[typename(typeVarName)]"`} + + `desc` may include one the following annotations: {`"[optional]"`, `"[range(start,end)]"`, `"[release]"`, `"[typename(typeVarName)]"`, `"[bounds(offset,size)]"`} - `optional` is used for params that are handles or pointers where it is legal for the value to be `nullptr` - `range` is used for params that are array pointers to specify the valid range that the is valid to read + `start` and `end` must be an ISO-C standard identifier or literal + `start` is inclusive and `end` is exclusive - `release` is used for params that are handles or pointers to handles where the function will destroy any backing memory associated with the handle(s) - `typename` is used to denote the type enum for params that are opaque pointers to values of tagged data types. + - `bounds` is used for params that are memory objects or USM allocations. It specifies the range within the memory allocation represented by the param that will be accessed by the operation. + + `offset` and `size` must be an ISO-C standard identifier or literal + + The sum of `offset` and `size` will be compared against the size of the memory allocation represented by the param. + + If `offset` and `size` are not both integers they must be of the types `$x_rect_offset` and `$x_rect_region` respectively. + + If `bounds` is used the operation must also take a parameter of type `$x_queue_handle_t` + `type` must be an ISO-C standard identifier + `name` must be a unique ISO-C standard identifier - A param may take the following optional scalar field: {`init`, `version`} diff --git a/scripts/core/enqueue.yml b/scripts/core/enqueue.yml index 7da1c8f680..7af03074c9 100644 --- a/scripts/core/enqueue.yml +++ b/scripts/core/enqueue.yml @@ -158,7 +158,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBuffer - desc: "[in] handle of the buffer object" + desc: "[in][bounds(offset, size)] handle of the buffer object" - type: bool name: blockingRead desc: "[in] indicates blocking (true), non-blocking (false)" @@ -211,7 +211,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBuffer - desc: "[in] handle of the buffer object" + desc: "[in][bounds(offset, size)] handle of the buffer object" - type: bool name: blockingWrite desc: "[in] indicates blocking (true), non-blocking (false)" @@ -265,7 +265,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBuffer - desc: "[in] handle of the buffer object" + desc: "[in][bounds(bufferOrigin, region)] handle of the buffer object" - type: bool name: blockingRead desc: "[in] indicates blocking (true), non-blocking (false)" @@ -341,7 +341,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBuffer - desc: "[in] handle of the buffer object" + desc: "[in][bounds(bufferOrigin, region)] handle of the buffer object" - type: bool name: blockingWrite desc: "[in] indicates blocking (true), non-blocking (false)" @@ -414,10 +414,10 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBufferSrc - desc: "[in] handle of the src buffer object" + desc: "[in][bounds(srcOffset, size)] handle of the src buffer object" - type: $x_mem_handle_t name: hBufferDst - desc: "[in] handle of the dest buffer object" + desc: "[in][bounds(dstOffset, size)] handle of the dest buffer object" - type: size_t name: srcOffset desc: "[in] offset into hBufferSrc to begin copying from" @@ -466,10 +466,10 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBufferSrc - desc: "[in] handle of the source buffer object" + desc: "[in][bounds(srcOrigin, region)] handle of the source buffer object" - type: $x_mem_handle_t name: hBufferDst - desc: "[in] handle of the dest buffer object" + desc: "[in][bounds(dstOrigin, region)] handle of the dest buffer object" - type: $x_rect_offset_t name: srcOrigin desc: "[in] 3D offset in the source buffer" @@ -537,7 +537,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBuffer - desc: "[in] handle of the buffer object" + desc: "[in][bounds(offset, size)] handle of the buffer object" - type: "const void*" name: pPattern desc: "[in] pointer to the fill pattern" @@ -595,7 +595,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hImage - desc: "[in] handle of the image object" + desc: "[in][bounds(origin, region)] handle of the image object" - type: bool name: blockingRead desc: "[in] indicates blocking (true), non-blocking (false)" @@ -654,7 +654,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hImage - desc: "[in] handle of the image object" + desc: "[in][bounds(origin, region)] handle of the image object" - type: bool name: blockingWrite desc: "[in] indicates blocking (true), non-blocking (false)" @@ -711,10 +711,10 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hImageSrc - desc: "[in] handle of the src image object" + desc: "[in][bounds(srcOrigin, region)] handle of the src image object" - type: $x_mem_handle_t name: hImageDst - desc: "[in] handle of the dest image object" + desc: "[in][bounds(dstOrigin, region)] handle of the dest image object" - type: $x_rect_offset_t name: srcOrigin desc: "[in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D image" @@ -842,7 +842,7 @@ params: desc: "[in] handle of the queue object" - type: $x_mem_handle_t name: hBuffer - desc: "[in] handle of the buffer object" + desc: "[in][bounds(offset, size)] handle of the buffer object" - type: bool name: blockingMap desc: "[in] indicates blocking (true), non-blocking (false)" @@ -996,8 +996,8 @@ params: name: hQueue desc: "[in] handle of the queue object" - type: void* - name: ptr - desc: "[in] pointer to USM memory object" + name: pMem + desc: "[in][bounds(0, size)] pointer to USM memory object" - type: size_t name: patternSize desc: "[in] the size in bytes of the pattern. Must be a power of 2 and less than or equal to width." @@ -1050,10 +1050,10 @@ params: desc: "[in] blocking or non-blocking copy" - type: void* name: pDst - desc: "[in] pointer to the destination USM memory object" + desc: "[in][bounds(0, size)] pointer to the destination USM memory object" - type: "const void*" name: pSrc - desc: "[in] pointer to the source USM memory object" + desc: "[in][bounds(0, size)] pointer to the source USM memory object" - type: size_t name: size desc: "[in] size in bytes to be copied" @@ -1097,7 +1097,7 @@ params: desc: "[in] handle of the queue object" - type: "const void*" name: pMem - desc: "[in] pointer to the USM memory object" + desc: "[in][bounds(0, size)] pointer to the USM memory object" - type: size_t name: size desc: "[in] size in bytes to be fetched" @@ -1144,7 +1144,7 @@ params: desc: "[in] handle of the queue object" - type: "const void*" name: pMem - desc: "[in] pointer to the USM memory object" + desc: "[in][bounds(0, size)] pointer to the USM memory object" - type: size_t name: size desc: "[in] size in bytes to be advised" @@ -1176,7 +1176,7 @@ params: desc: "[in] handle of the queue to submit to." - type: void* name: pMem - desc: "[in] pointer to memory to be filled." + desc: "[in][bounds(0, pitch * height)] pointer to memory to be filled." - type: size_t name: pitch desc: "[in] the total width of the destination memory including padding." @@ -1238,13 +1238,13 @@ params: desc: "[in] indicates if this operation should block the host." - type: void* name: pDst - desc: "[in] pointer to memory where data will be copied." + desc: "[in][bounds(0, dstPitch * height)] pointer to memory where data will be copied." - type: size_t name: dstPitch desc: "[in] the total width of the source memory including padding." - type: "const void*" name: pSrc - desc: "[in] pointer to memory to be copied." + desc: "[in][bounds(0, srcPitch * height)] pointer to memory to be copied." - type: size_t name: srcPitch desc: "[in] the total width of the source memory including padding." diff --git a/scripts/parse_specs.py b/scripts/parse_specs.py index a1477ce534..332af88cc7 100644 --- a/scripts/parse_specs.py +++ b/scripts/parse_specs.py @@ -338,6 +338,15 @@ def __validate_params(d, tags): if not param_traits.is_range(item): raise Exception(prefix+"handle type must include a range(start, end) as part of 'desc'") + if param_traits.is_bounds(item): + has_queue = False + for p in d['params']: + if re.match(r"hQueue$", p['name']): + has_queue = True + + if not has_queue: + raise Exception(prefix+"bounds must only be used on entry points which take a `hQueue` parameter") + ver = __validate_version(item, prefix=prefix, base_version=d_ver) if ver < max_ver: raise Exception(prefix+"'version' must be increasing: %s"%item['version']) diff --git a/scripts/templates/helper.py b/scripts/templates/helper.py index 4fbb2ca47b..928db1675c 100644 --- a/scripts/templates/helper.py +++ b/scripts/templates/helper.py @@ -356,6 +356,7 @@ class param_traits: RE_RELEASE = r".*\[release\].*" RE_TYPENAME = r".*\[typename\((.+),\s(.+)\)\].*" RE_TAGGED = r".*\[tagged_by\((.+)\)].*" + RE_BOUNDS = r".*\[bounds\((.+),\s*(.+)\)].*" @classmethod def is_mbz(cls, item): @@ -412,6 +413,13 @@ def is_tagged(cls, item): return True if re.match(cls.RE_TAGGED, item['desc']) else False except: return False + + @classmethod + def is_bounds(cls, item): + try: + return True if re.match(cls.RE_BOUNDS, item['desc']) else False + except: + return False @classmethod def tagged_member(cls, item): @@ -457,6 +465,22 @@ def typename_size(cls, item): else: return None + @classmethod + def bounds_offset(cls, item): + match = re.match(cls.RE_BOUNDS, item['desc']) + if match: + return match.group(1) + else: + return None + + @classmethod + def bounds_size(cls, item): + match = re.match(cls.RE_BOUNDS, item['desc']) + if match: + return match.group(2) + else: + return None + """ Extracts traits from a function object """ @@ -1041,7 +1065,35 @@ def make_pfncb_param_type(namespace, tags, obj): """ Public: - returns a dict of auto-generated c++ parameter validation checks + returns an appropriate bounds helper function call for an entry point + parameter with the [bounds] tag +""" +def get_bounds_check(param, bounds_error): + # Images need their own helper, since function signature wise they would be + # identical to buffer rect + bounds_function = 'boundsImage' if 'image' in param['name'].lower() else 'bounds' + bounds_check = "auto {0} = {1}({2}, {3}, {4})".format( + bounds_error, + bounds_function, + param["name"], + param_traits.bounds_offset(param), + param_traits.bounds_size(param), + ) + bounds_check += '; {0} != UR_RESULT_SUCCESS'.format(bounds_error) + + # USM bounds checks need the queue handle parameter to be able to use the + # GetMemAllocInfo entry point + if type_traits.is_pointer(param['type']): + # If no `hQueue` parameter exists that should have been caught at spec + # generation. + return re.sub(r'bounds\(', 'bounds(hQueue, ', bounds_check) + + return bounds_check + +""" +Public: + returns a dict of auto-generated c++ parameter validation checks for the + given function (specified by `obj`) """ def make_param_checks(namespace, tags, obj, cpp=False, meta=None): checks = {} @@ -1054,6 +1106,13 @@ def make_param_checks(namespace, tags, obj, cpp=False, meta=None): if key not in checks: checks[key] = [] checks[key].append(subt(namespace, tags, code.group(1), False, cpp)) + + for p in obj.get('params', []): + if param_traits.is_bounds(p): + if 'boundsError' not in checks: + checks['boundsError'] = [] + checks['boundsError'].append(get_bounds_check(p, 'boundsError')) + return checks """ diff --git a/source/adapters/hip/usm.cpp b/source/adapters/hip/usm.cpp index 7af7401f87..0aaf6de53e 100644 --- a/source/adapters/hip/usm.cpp +++ b/source/adapters/hip/usm.cpp @@ -190,9 +190,6 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem, #endif return ReturnValue(UR_USM_TYPE_UNKNOWN); } - case UR_USM_ALLOC_INFO_BASE_PTR: - case UR_USM_ALLOC_INFO_SIZE: - return UR_RESULT_ERROR_INVALID_VALUE; case UR_USM_ALLOC_INFO_DEVICE: { // get device index associated with this pointer UR_CHECK_ERROR(hipPointerGetAttributes(&hipPointerAttributeType, pMem)); @@ -222,6 +219,9 @@ urUSMGetMemAllocInfo(ur_context_handle_t hContext, const void *pMem, } return ReturnValue(Pool); } + case UR_USM_ALLOC_INFO_BASE_PTR: + case UR_USM_ALLOC_INFO_SIZE: + return UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION; default: return UR_RESULT_ERROR_INVALID_ENUMERATION; } diff --git a/source/adapters/null/ur_nullddi.cpp b/source/adapters/null/ur_nullddi.cpp index a4e91e3dc0..f016830d11 100644 --- a/source/adapters/null/ur_nullddi.cpp +++ b/source/adapters/null/ur_nullddi.cpp @@ -2917,7 +2917,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( /// @brief Intercept function for urEnqueueMemBufferRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -2956,7 +2957,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( /// @brief Intercept function for urEnqueueMemBufferWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object @@ -2997,7 +2999,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( /// @brief Intercept function for urEnqueueMemBufferReadRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -3050,7 +3053,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( /// @brief Intercept function for urEnqueueMemBufferWriteRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer @@ -3105,9 +3109,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -3144,9 +3150,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopyRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t @@ -3195,10 +3203,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// @brief Intercept function for urEnqueueMemBufferFill __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object - const void *pPattern, ///< [in] pointer to the fill pattern - size_t patternSize, ///< [in] size in bytes of the pattern - size_t offset, ///< [in] offset into the buffer + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object + const void *pPattern, ///< [in] pointer to the fill pattern + size_t patternSize, ///< [in] size in bytes of the pattern + size_t offset, ///< [in] offset into the buffer size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -3234,7 +3243,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( /// @brief Intercept function for urEnqueueMemImageRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image @@ -3278,7 +3288,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( /// @brief Intercept function for urEnqueueMemImageWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t @@ -3322,9 +3333,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemImageCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t + hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image @@ -3368,7 +3381,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( /// @brief Intercept function for urEnqueueMemBufferMap __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -3445,7 +3459,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( /// @brief Intercept function for urEnqueueUSMFill __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -3468,7 +3482,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( // if the driver has created a custom function, then call it instead of using the generic path auto pfnUSMFill = d_context.urDdiTable.Enqueue.pfnUSMFill; if (nullptr != pfnUSMFill) { - result = pfnUSMFill(hQueue, ptr, patternSize, pPattern, size, + result = pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, numEventsInWaitList, phEventWaitList, phEvent); } else { // generic implementation @@ -3487,9 +3501,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object - size_t size, ///< [in] size in bytes to be copied + void * + pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void * + pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object + size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -3522,9 +3538,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMPrefetch __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be fetched + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -3558,9 +3575,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMAdvise __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be advised + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t * phEvent ///< [out][optional] return an event object that identifies this particular @@ -3588,7 +3606,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( /// @brief Intercept function for urEnqueueUSMFill2D __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void * + pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t @@ -3635,10 +3654,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void * + pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void * + pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. diff --git a/source/adapters/opencl/enqueue.cpp b/source/adapters/opencl/enqueue.cpp index 24d60e62f5..6830a28eec 100644 --- a/source/adapters/opencl/enqueue.cpp +++ b/source/adapters/opencl/enqueue.cpp @@ -25,77 +25,6 @@ cl_map_flags convertURMapFlagsToCL(ur_map_flags_t URFlags) { return CLFlags; } -ur_result_t ValidateBufferSize(ur_mem_handle_t Buffer, size_t Size, - size_t Origin) { - size_t BufferSize = 0; - CL_RETURN_ON_FAILURE(clGetMemObjectInfo(cl_adapter::cast(Buffer), - CL_MEM_SIZE, sizeof(BufferSize), - &BufferSize, nullptr)); - if (Size + Origin > BufferSize) - return UR_RESULT_ERROR_INVALID_SIZE; - return UR_RESULT_SUCCESS; -} - -ur_result_t ValidateBufferRectSize(ur_mem_handle_t Buffer, - ur_rect_region_t Region, - ur_rect_offset_t Offset) { - size_t BufferSize = 0; - CL_RETURN_ON_FAILURE(clGetMemObjectInfo(cl_adapter::cast(Buffer), - CL_MEM_SIZE, sizeof(BufferSize), - &BufferSize, nullptr)); - if (Offset.x >= BufferSize || Offset.y >= BufferSize || - Offset.z >= BufferSize) { - return UR_RESULT_ERROR_INVALID_SIZE; - } - - if ((Region.width + Offset.x) * (Region.height + Offset.y) * - (Region.depth + Offset.z) > - BufferSize) { - return UR_RESULT_ERROR_INVALID_SIZE; - } - - return UR_RESULT_SUCCESS; -} - -ur_result_t ValidateImageSize(ur_mem_handle_t Image, ur_rect_region_t Region, - ur_rect_offset_t Origin) { - size_t Width = 0; - CL_RETURN_ON_FAILURE(clGetImageInfo(cl_adapter::cast(Image), - CL_IMAGE_WIDTH, sizeof(Width), &Width, - nullptr)); - if (Region.width + Origin.x > Width) { - return UR_RESULT_ERROR_INVALID_SIZE; - } - - size_t Height = 0; - CL_RETURN_ON_FAILURE(clGetImageInfo(cl_adapter::cast(Image), - CL_IMAGE_HEIGHT, sizeof(Height), &Height, - nullptr)); - - // CL returns a height and depth of 0 for images that don't have those - // dimensions, but regions for enqueue operations must set these to 1, so we - // need to make this adjustment to validate. - if (Height == 0) - Height = 1; - - if (Region.height + Origin.y > Height) { - return UR_RESULT_ERROR_INVALID_SIZE; - } - - size_t Depth = 0; - CL_RETURN_ON_FAILURE(clGetImageInfo(cl_adapter::cast(Image), - CL_IMAGE_DEPTH, sizeof(Depth), &Depth, - nullptr)); - if (Depth == 0) - Depth = 1; - - if (Region.depth + Origin.z > Depth) { - return UR_RESULT_ERROR_INVALID_SIZE; - } - - return UR_RESULT_SUCCESS; -} - UR_APIEXPORT ur_result_t UR_APICALL urEnqueueKernelLaunch( ur_queue_handle_t hQueue, ur_kernel_handle_t hKernel, uint32_t workDim, const size_t *pGlobalWorkOffset, const size_t *pGlobalWorkSize, @@ -141,16 +70,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferRead( size_t offset, size_t size, void *pDst, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - auto ClErr = clEnqueueReadBuffer( + CL_RETURN_ON_FAILURE(clEnqueueReadBuffer( cl_adapter::cast(hQueue), cl_adapter::cast(hBuffer), blockingRead, offset, size, pDst, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBuffer, size, offset)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( @@ -158,16 +84,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWrite( size_t offset, size_t size, const void *pSrc, uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - auto ClErr = clEnqueueWriteBuffer( + CL_RETURN_ON_FAILURE(clEnqueueWriteBuffer( cl_adapter::cast(hQueue), cl_adapter::cast(hBuffer), blockingWrite, offset, size, pSrc, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBuffer, size, offset)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect( @@ -182,18 +105,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferReadRect( const size_t HostOrigin[3] = {hostOrigin.x, hostOrigin.y, hostOrigin.z}; const size_t Region[3] = {region.width, region.height, region.depth}; - auto ClErr = clEnqueueReadBufferRect( + CL_RETURN_ON_FAILURE(clEnqueueReadBufferRect( cl_adapter::cast(hQueue), cl_adapter::cast(hBuffer), blockingRead, BufferOrigin, HostOrigin, Region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pDst, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferRectSize(hBuffer, region, bufferOrigin)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( @@ -208,18 +128,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( const size_t HostOrigin[3] = {hostOrigin.x, hostOrigin.y, hostOrigin.z}; const size_t Region[3] = {region.width, region.height, region.depth}; - auto ClErr = clEnqueueWriteBufferRect( + CL_RETURN_ON_FAILURE(clEnqueueWriteBufferRect( cl_adapter::cast(hQueue), cl_adapter::cast(hBuffer), blockingWrite, BufferOrigin, HostOrigin, Region, bufferRowPitch, bufferSlicePitch, hostRowPitch, hostSlicePitch, pSrc, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferRectSize(hBuffer, region, bufferOrigin)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy( @@ -228,18 +145,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopy( uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, ur_event_handle_t *phEvent) { - auto ClErr = clEnqueueCopyBuffer( + CL_RETURN_ON_FAILURE(clEnqueueCopyBuffer( cl_adapter::cast(hQueue), cl_adapter::cast(hBufferSrc), cl_adapter::cast(hBufferDst), srcOffset, dstOffset, size, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBufferSrc, size, srcOffset)); - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBufferDst, size, dstOffset)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( @@ -253,19 +166,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( const size_t DstOrigin[3] = {dstOrigin.x, dstOrigin.y, dstOrigin.z}; const size_t Region[3] = {region.width, region.height, region.depth}; - auto ClErr = clEnqueueCopyBufferRect( + CL_RETURN_ON_FAILURE(clEnqueueCopyBufferRect( cl_adapter::cast(hQueue), cl_adapter::cast(hBufferSrc), cl_adapter::cast(hBufferDst), SrcOrigin, DstOrigin, Region, srcRowPitch, srcSlicePitch, dstRowPitch, dstSlicePitch, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferRectSize(hBufferSrc, region, srcOrigin)); - UR_RETURN_ON_FAILURE(ValidateBufferRectSize(hBufferDst, region, dstOrigin)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( @@ -276,16 +185,13 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( // CL FillBuffer only allows pattern sizes up to the largest CL type: // long16/double16 if (patternSize <= 128) { - auto ClErr = (clEnqueueFillBuffer( - cl_adapter::cast(hQueue), - cl_adapter::cast(hBuffer), pPattern, patternSize, offset, size, - numEventsInWaitList, - cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent))); - if (ClErr != CL_SUCCESS) { - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBuffer, size, offset)); - } - return mapCLErrorToUR(ClErr); + CL_RETURN_ON_FAILURE( + clEnqueueFillBuffer(cl_adapter::cast(hQueue), + cl_adapter::cast(hBuffer), pPattern, + patternSize, offset, size, numEventsInWaitList, + cl_adapter::cast(phEventWaitList), + cl_adapter::cast(phEvent))); + return UR_RESULT_SUCCESS; } auto NumValues = size / sizeof(uint64_t); @@ -303,7 +209,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferFill( &WriteEvent); if (ClErr != CL_SUCCESS) { delete[] HostBuffer; - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBuffer, offset, size)); CL_RETURN_ON_FAILURE(ClErr); } @@ -338,17 +243,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageRead( const size_t Origin[3] = {origin.x, origin.y, origin.z}; const size_t Region[3] = {region.width, region.height, region.depth}; - auto ClErr = clEnqueueReadImage( + CL_RETURN_ON_FAILURE(clEnqueueReadImage( cl_adapter::cast(hQueue), cl_adapter::cast(hImage), blockingRead, Origin, Region, rowPitch, slicePitch, pDst, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateImageSize(hImage, region, origin)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( @@ -359,17 +261,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageWrite( const size_t Origin[3] = {origin.x, origin.y, origin.z}; const size_t Region[3] = {region.width, region.height, region.depth}; - auto ClErr = clEnqueueWriteImage( + CL_RETURN_ON_FAILURE(clEnqueueWriteImage( cl_adapter::cast(hQueue), cl_adapter::cast(hImage), blockingWrite, Origin, Region, rowPitch, slicePitch, pSrc, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateImageSize(hImage, region, origin)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( @@ -382,18 +281,14 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemImageCopy( const size_t DstOrigin[3] = {dstOrigin.x, dstOrigin.y, dstOrigin.z}; const size_t Region[3] = {region.width, region.height, region.depth}; - auto ClErr = clEnqueueCopyImage( + CL_RETURN_ON_FAILURE(clEnqueueCopyImage( cl_adapter::cast(hQueue), cl_adapter::cast(hImageSrc), cl_adapter::cast(hImageDst), SrcOrigin, DstOrigin, Region, numEventsInWaitList, cl_adapter::cast(phEventWaitList), - cl_adapter::cast(phEvent)); + cl_adapter::cast(phEvent))); - if (ClErr == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateImageSize(hImageSrc, region, srcOrigin)); - UR_RETURN_ON_FAILURE(ValidateImageSize(hImageDst, region, dstOrigin)); - } - return mapCLErrorToUR(ClErr); + return UR_RESULT_SUCCESS; } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap( @@ -410,9 +305,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueMemBufferMap( cl_adapter::cast(phEventWaitList), cl_adapter::cast(phEvent), &Err); - if (Err == CL_INVALID_VALUE) { - UR_RETURN_ON_FAILURE(ValidateBufferSize(hBuffer, size, offset)); - } return mapCLErrorToUR(Err); } diff --git a/source/loader/layers/tracing/ur_trcddi.cpp b/source/loader/layers/tracing/ur_trcddi.cpp index d33a3aaf51..402b64d638 100644 --- a/source/loader/layers/tracing/ur_trcddi.cpp +++ b/source/loader/layers/tracing/ur_trcddi.cpp @@ -3325,7 +3325,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( /// @brief Intercept function for urEnqueueMemBufferRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -3367,7 +3368,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( /// @brief Intercept function for urEnqueueMemBufferWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object @@ -3412,7 +3414,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( /// @brief Intercept function for urEnqueueMemBufferReadRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -3479,7 +3482,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( /// @brief Intercept function for urEnqueueMemBufferWriteRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer @@ -3549,9 +3553,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -3590,9 +3596,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopyRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t @@ -3646,10 +3654,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// @brief Intercept function for urEnqueueMemBufferFill __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object - const void *pPattern, ///< [in] pointer to the fill pattern - size_t patternSize, ///< [in] size in bytes of the pattern - size_t offset, ///< [in] offset into the buffer + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object + const void *pPattern, ///< [in] pointer to the fill pattern + size_t patternSize, ///< [in] size in bytes of the pattern + size_t offset, ///< [in] offset into the buffer size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -3693,7 +3702,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( /// @brief Intercept function for urEnqueueMemImageRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image @@ -3741,7 +3751,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( /// @brief Intercept function for urEnqueueMemImageWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t @@ -3789,9 +3800,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemImageCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t + hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image @@ -3837,7 +3850,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( /// @brief Intercept function for urEnqueueMemBufferMap __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -3920,7 +3934,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( /// @brief Intercept function for urEnqueueUSMFill __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -3945,14 +3959,14 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( } ur_enqueue_usm_fill_params_t params = { - &hQueue, &ptr, &patternSize, + &hQueue, &pMem, &patternSize, &pPattern, &size, &numEventsInWaitList, &phEventWaitList, &phEvent}; uint64_t instance = context.notify_begin(UR_FUNCTION_ENQUEUE_USM_FILL, "urEnqueueUSMFill", ¶ms); ur_result_t result = - pfnUSMFill(hQueue, ptr, patternSize, pPattern, size, + pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, numEventsInWaitList, phEventWaitList, phEvent); context.notify_end(UR_FUNCTION_ENQUEUE_USM_FILL, "urEnqueueUSMFill", @@ -3966,9 +3980,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object - size_t size, ///< [in] size in bytes to be copied + void * + pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void * + pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object + size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -4004,9 +4020,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMPrefetch __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be fetched + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -4043,9 +4060,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMAdvise __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be advised + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t * phEvent ///< [out][optional] return an event object that identifies this particular @@ -4074,7 +4092,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( /// @brief Intercept function for urEnqueueUSMFill2D __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void * + pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t @@ -4124,10 +4143,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void * + pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void * + pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. diff --git a/source/loader/layers/validation/ur_valddi.cpp b/source/loader/layers/validation/ur_valddi.cpp index ec0df692cf..72e225028c 100644 --- a/source/loader/layers/validation/ur_valddi.cpp +++ b/source/loader/layers/validation/ur_valddi.cpp @@ -4084,7 +4084,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( /// @brief Intercept function for urEnqueueMemBufferRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -4126,6 +4127,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hBuffer, offset, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4146,7 +4152,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( /// @brief Intercept function for urEnqueueMemBufferWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object @@ -4190,6 +4197,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hBuffer, offset, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4210,7 +4222,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( /// @brief Intercept function for urEnqueueMemBufferReadRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -4304,6 +4317,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = bounds(hBuffer, bufferOrigin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4325,7 +4343,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( /// @brief Intercept function for urEnqueueMemBufferWriteRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer @@ -4423,6 +4442,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = bounds(hBuffer, bufferOrigin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4443,9 +4467,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -4486,6 +4512,16 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hBufferSrc, srcOffset, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + + if (auto boundsError = bounds(hBufferDst, dstOffset, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4505,9 +4541,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopyRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t @@ -4593,6 +4631,16 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = bounds(hBufferSrc, srcOrigin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + + if (auto boundsError = bounds(hBufferDst, dstOrigin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4614,10 +4662,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// @brief Intercept function for urEnqueueMemBufferFill __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object - const void *pPattern, ///< [in] pointer to the fill pattern - size_t patternSize, ///< [in] size in bytes of the pattern - size_t offset, ///< [in] offset into the buffer + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object + const void *pPattern, ///< [in] pointer to the fill pattern + size_t patternSize, ///< [in] size in bytes of the pattern + size_t offset, ///< [in] offset into the buffer size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -4676,6 +4725,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = bounds(hBuffer, offset, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4696,7 +4750,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( /// @brief Intercept function for urEnqueueMemImageRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image @@ -4747,6 +4802,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = boundsImage(hImage, origin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4767,7 +4827,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( /// @brief Intercept function for urEnqueueMemImageWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t @@ -4819,6 +4880,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = boundsImage(hImage, origin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4838,9 +4904,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemImageCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t + hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image @@ -4891,6 +4959,16 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( return UR_RESULT_ERROR_INVALID_SIZE; } + if (auto boundsError = boundsImage(hImageSrc, srcOrigin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + + if (auto boundsError = boundsImage(hImageDst, dstOrigin, region); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -4911,7 +4989,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( /// @brief Intercept function for urEnqueueMemBufferMap __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -4959,6 +5038,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hBuffer, offset, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -5039,7 +5123,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( /// @brief Intercept function for urEnqueueUSMFill __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -5068,7 +5152,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( return UR_RESULT_ERROR_INVALID_NULL_HANDLE; } - if (NULL == ptr) { + if (NULL == pMem) { return UR_RESULT_ERROR_INVALID_NULL_POINTER; } @@ -5100,6 +5184,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hQueue, pMem, 0, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -5110,7 +5199,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( } ur_result_t result = - pfnUSMFill(hQueue, ptr, patternSize, pPattern, size, + pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, numEventsInWaitList, phEventWaitList, phEvent); return result; @@ -5121,9 +5210,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object - size_t size, ///< [in] size in bytes to be copied + void * + pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void * + pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object + size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -5165,6 +5256,16 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hQueue, pDst, 0, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + + if (auto boundsError = bounds(hQueue, pSrc, 0, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -5184,9 +5285,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMPrefetch __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be fetched + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -5229,6 +5331,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hQueue, pMem, 0, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -5248,9 +5355,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMAdvise __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be advised + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t * phEvent ///< [out][optional] return an event object that identifies this particular @@ -5278,6 +5386,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( if (size == 0) { return UR_RESULT_ERROR_INVALID_SIZE; } + + if (auto boundsError = bounds(hQueue, pMem, 0, size); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } } ur_result_t result = pfnUSMAdvise(hQueue, pMem, size, advice, phEvent); @@ -5289,7 +5402,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( /// @brief Intercept function for urEnqueueUSMFill2D __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void * + pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t @@ -5370,6 +5484,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hQueue, pMem, 0, pitch * height); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { @@ -5391,10 +5510,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void * + pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void * + pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. @@ -5456,6 +5578,16 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( return UR_RESULT_ERROR_INVALID_EVENT_WAIT_LIST; } + if (auto boundsError = bounds(hQueue, pDst, 0, dstPitch * height); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + + if (auto boundsError = bounds(hQueue, pSrc, 0, srcPitch * height); + boundsError != UR_RESULT_SUCCESS) { + return boundsError; + } + if (phEventWaitList != NULL && numEventsInWaitList > 0) { for (uint32_t i = 0; i < numEventsInWaitList; ++i) { if (phEventWaitList[i] == NULL) { diff --git a/source/loader/layers/validation/ur_validation_layer.cpp b/source/loader/layers/validation/ur_validation_layer.cpp index 5cd3f8c13a..3e040fcc50 100644 --- a/source/loader/layers/validation/ur_validation_layer.cpp +++ b/source/loader/layers/validation/ur_validation_layer.cpp @@ -11,6 +11,8 @@ */ #include "ur_validation_layer.hpp" +#include + namespace ur_validation_layer { context_t context; @@ -20,4 +22,127 @@ context_t::context_t() : logger(logger::create_logger("validation")) {} /////////////////////////////////////////////////////////////////////////////// context_t::~context_t() {} +// Some adapters don't support all the queries yet, we should be lenient and +// just not attempt to validate in those cases to preserve functionality. +#define RETURN_ON_FAILURE(result) \ + if (result == UR_RESULT_ERROR_UNSUPPORTED_ENUMERATION || \ + result == UR_RESULT_ERROR_UNSUPPORTED_FEATURE) \ + return UR_RESULT_SUCCESS; \ + if (result != UR_RESULT_SUCCESS) { \ + context.logger.error("Unexpected non-success result code from {}", \ + #result); \ + assert(0); \ + return result; \ + } + +ur_result_t bounds(ur_mem_handle_t buffer, size_t offset, size_t size) { + auto pfnMemGetInfo = context.urDdiTable.Mem.pfnGetInfo; + + size_t bufferSize = 0; + RETURN_ON_FAILURE(pfnMemGetInfo(buffer, UR_MEM_INFO_SIZE, + sizeof(bufferSize), &bufferSize, nullptr)); + + if (size + offset > bufferSize) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + return UR_RESULT_SUCCESS; +} + +ur_result_t bounds(ur_mem_handle_t buffer, ur_rect_offset_t offset, + ur_rect_region_t region) { + auto pfnMemGetInfo = context.urDdiTable.Mem.pfnGetInfo; + + size_t bufferSize = 0; + RETURN_ON_FAILURE(pfnMemGetInfo(buffer, UR_MEM_INFO_SIZE, + sizeof(bufferSize), &bufferSize, nullptr)); + + if (offset.x >= bufferSize || offset.y >= bufferSize || + offset.z >= bufferSize) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + if ((region.width + offset.x) * (region.height + offset.y) * + (region.depth + offset.z) > + bufferSize) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + return UR_RESULT_SUCCESS; +} + +ur_result_t bounds(ur_queue_handle_t queue, const void *ptr, size_t offset, + size_t size) { + auto pfnQueueGetInfo = context.urDdiTable.Queue.pfnGetInfo; + auto pfnUSMGetMemAllocInfo = context.urDdiTable.USM.pfnGetMemAllocInfo; + + ur_context_handle_t urContext = nullptr; + RETURN_ON_FAILURE(pfnQueueGetInfo(queue, UR_QUEUE_INFO_CONTEXT, + sizeof(ur_context_handle_t), &urContext, + nullptr)); + ur_usm_type_t usmType = UR_USM_TYPE_UNKNOWN; + RETURN_ON_FAILURE( + pfnUSMGetMemAllocInfo(urContext, ptr, UR_USM_ALLOC_INFO_TYPE, + sizeof(usmType), &usmType, nullptr)); + + // We can't reliably get size info about pointers that didn't come from the + // USM alloc entry points. + if (usmType == UR_USM_TYPE_UNKNOWN) { + return UR_RESULT_SUCCESS; + } + + size_t allocSize = 0; + RETURN_ON_FAILURE( + pfnUSMGetMemAllocInfo(urContext, ptr, UR_USM_ALLOC_INFO_SIZE, + sizeof(allocSize), &allocSize, nullptr)); + + if (size + offset > allocSize) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + return UR_RESULT_SUCCESS; +} + +ur_result_t boundsImage(ur_mem_handle_t image, ur_rect_offset_t origin, + ur_rect_region_t region) { + auto pfnMemImageGetInfo = context.urDdiTable.Mem.pfnImageGetInfo; + + size_t width = 0; + RETURN_ON_FAILURE(pfnMemImageGetInfo(image, UR_IMAGE_INFO_WIDTH, + sizeof(width), &width, nullptr)); + if (region.width + origin.x > width) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + size_t height = 0; + RETURN_ON_FAILURE(pfnMemImageGetInfo(image, UR_IMAGE_INFO_HEIGHT, + sizeof(height), &height, nullptr)); + + // Some adapters return a height and depth of 0 for images that don't have + // those dimensions, but regions for enqueue operations must set these to + // 1, so we need to make this adjustment to properly validate. + if (height == 0) { + height = 1; + } + + if (region.height + origin.y > height) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + size_t depth = 0; + RETURN_ON_FAILURE(pfnMemImageGetInfo(image, UR_IMAGE_INFO_DEPTH, + sizeof(depth), &depth, nullptr)); + if (depth == 0) { + depth = 1; + } + + if (region.depth + origin.z > depth) { + return UR_RESULT_ERROR_INVALID_SIZE; + } + + return UR_RESULT_SUCCESS; +} + +#undef RETURN_ON_FAILURE + } // namespace ur_validation_layer diff --git a/source/loader/layers/validation/ur_validation_layer.hpp b/source/loader/layers/validation/ur_validation_layer.hpp index e41c621dc8..d29b64230e 100644 --- a/source/loader/layers/validation/ur_validation_layer.hpp +++ b/source/loader/layers/validation/ur_validation_layer.hpp @@ -44,6 +44,17 @@ class __urdlllocal context_t : public proxy_layer_context_t { const std::string nameLeakChecking = "UR_LAYER_LEAK_CHECKING"; }; +ur_result_t bounds(ur_mem_handle_t buffer, size_t offset, size_t size); + +ur_result_t bounds(ur_mem_handle_t buffer, ur_rect_offset_t offset, + ur_rect_region_t region); + +ur_result_t bounds(ur_queue_handle_t queue, const void *ptr, size_t offset, + size_t size); + +ur_result_t boundsImage(ur_mem_handle_t image, ur_rect_offset_t origin, + ur_rect_region_t region); + extern context_t context; } // namespace ur_validation_layer diff --git a/source/loader/ur_ldrddi.cpp b/source/loader/ur_ldrddi.cpp index 27d8011cf7..5d7df7e672 100644 --- a/source/loader/ur_ldrddi.cpp +++ b/source/loader/ur_ldrddi.cpp @@ -3852,7 +3852,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( /// @brief Intercept function for urEnqueueMemBufferRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -3916,7 +3917,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferRead( /// @brief Intercept function for urEnqueueMemBufferWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object @@ -3982,7 +3984,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWrite( /// @brief Intercept function for urEnqueueMemBufferReadRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -4059,7 +4062,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferReadRect( /// @brief Intercept function for urEnqueueMemBufferWriteRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer @@ -4138,9 +4142,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -4205,9 +4211,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemBufferCopyRect __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t @@ -4283,10 +4291,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// @brief Intercept function for urEnqueueMemBufferFill __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object - const void *pPattern, ///< [in] pointer to the fill pattern - size_t patternSize, ///< [in] size in bytes of the pattern - size_t offset, ///< [in] offset into the buffer + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object + const void *pPattern, ///< [in] pointer to the fill pattern + size_t patternSize, ///< [in] size in bytes of the pattern + size_t offset, ///< [in] offset into the buffer size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -4347,7 +4356,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferFill( /// @brief Intercept function for urEnqueueMemImageRead __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image @@ -4416,7 +4426,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageRead( /// @brief Intercept function for urEnqueueMemImageWrite __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t @@ -4485,9 +4496,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageWrite( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueMemImageCopy __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t + hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image @@ -4559,7 +4572,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemImageCopy( /// @brief Intercept function for urEnqueueMemBufferMap __urdlllocal ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -4686,7 +4700,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueMemUnmap( /// @brief Intercept function for urEnqueueUSMFill __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -4726,7 +4740,7 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( // forward to device-platform result = - pfnUSMFill(hQueue, ptr, patternSize, pPattern, size, + pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, numEventsInWaitList, phEventWaitListLocal.data(), phEvent); if (UR_RESULT_SUCCESS != result) { @@ -4751,9 +4765,11 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object - size_t size, ///< [in] size in bytes to be copied + void * + pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void * + pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object + size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -4809,9 +4825,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMPrefetch __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be fetched + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -4867,9 +4884,10 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMPrefetch( /////////////////////////////////////////////////////////////////////////////// /// @brief Intercept function for urEnqueueUSMAdvise __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be advised + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t * phEvent ///< [out][optional] return an event object that identifies this particular @@ -4911,7 +4929,8 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMAdvise( /// @brief Intercept function for urEnqueueUSMFill2D __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void * + pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t @@ -4980,10 +4999,13 @@ __urdlllocal ur_result_t UR_APICALL urEnqueueUSMFill2D( __urdlllocal ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void * + pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void * + pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. diff --git a/source/loader/ur_libapi.cpp b/source/loader/ur_libapi.cpp index de9e029536..80d1bc3fb6 100644 --- a/source/loader/ur_libapi.cpp +++ b/source/loader/ur_libapi.cpp @@ -4833,7 +4833,8 @@ ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -4894,7 +4895,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferRead( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object @@ -4967,7 +4969,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferWrite( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -5052,7 +5055,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferReadRect( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer @@ -5125,9 +5129,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -5191,9 +5197,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopy( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t @@ -5266,10 +5274,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object - const void *pPattern, ///< [in] pointer to the fill pattern - size_t patternSize, ///< [in] size in bytes of the pattern - size_t offset, ///< [in] offset into the buffer + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object + const void *pPattern, ///< [in] pointer to the fill pattern + size_t patternSize, ///< [in] size in bytes of the pattern + size_t offset, ///< [in] offset into the buffer size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -5329,7 +5338,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferFill( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image @@ -5396,7 +5406,8 @@ ur_result_t UR_APICALL urEnqueueMemImageRead( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t @@ -5458,9 +5469,11 @@ ur_result_t UR_APICALL urEnqueueMemImageWrite( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t + hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image @@ -5532,7 +5545,8 @@ ur_result_t UR_APICALL urEnqueueMemImageCopy( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -5625,7 +5639,7 @@ ur_result_t UR_APICALL urEnqueueMemUnmap( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == ptr` +/// + `NULL == pMem` /// + `NULL == pPattern` /// - ::UR_RESULT_ERROR_INVALID_QUEUE /// - ::UR_RESULT_ERROR_INVALID_EVENT @@ -5644,7 +5658,7 @@ ur_result_t UR_APICALL urEnqueueMemUnmap( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -5667,7 +5681,7 @@ ur_result_t UR_APICALL urEnqueueUSMFill( return UR_RESULT_ERROR_UNINITIALIZED; } - return pfnUSMFill(hQueue, ptr, patternSize, pPattern, size, + return pfnUSMFill(hQueue, pMem, patternSize, pPattern, size, numEventsInWaitList, phEventWaitList, phEvent); } catch (...) { return exceptionToResult(std::current_exception()); @@ -5701,9 +5715,11 @@ ur_result_t UR_APICALL urEnqueueUSMFill( ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object - size_t size, ///< [in] size in bytes to be copied + void * + pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void * + pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object + size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -5757,9 +5773,10 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueUSMPrefetch( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be fetched + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -5810,9 +5827,10 @@ ur_result_t UR_APICALL urEnqueueUSMPrefetch( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueUSMAdvise( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be advised + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t * phEvent ///< [out][optional] return an event object that identifies this particular @@ -5861,7 +5879,8 @@ ur_result_t UR_APICALL urEnqueueUSMAdvise( /// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void * + pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t @@ -5926,10 +5945,13 @@ ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void * + pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void * + pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. diff --git a/source/ur_api.cpp b/source/ur_api.cpp index ca1f82019c..3a7cebca8c 100644 --- a/source/ur_api.cpp +++ b/source/ur_api.cpp @@ -4094,7 +4094,8 @@ ur_result_t UR_APICALL urEnqueueEventsWaitWithBarrier( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object size_t size, ///< [in] size in bytes of data being read @@ -4147,7 +4148,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferRead( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) size_t offset, ///< [in] offset in bytes in the buffer object @@ -4212,7 +4214,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferWrite( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferReadRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer ur_rect_offset_t hostOrigin, ///< [in] 3D offset in the host region @@ -4287,7 +4290,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferReadRect( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(bufferOrigin, region)] handle of the buffer object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t bufferOrigin, ///< [in] 3D offset in the buffer @@ -4350,9 +4354,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferWriteRect( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the src buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOffset, size)] handle of the src buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOffset, size)] handle of the dest buffer object size_t srcOffset, ///< [in] offset into hBufferSrc to begin copying from size_t dstOffset, ///< [in] offset info hBufferDst to begin copying into size_t size, ///< [in] size in bytes of data being copied @@ -4407,9 +4413,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopy( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBufferSrc, ///< [in] handle of the source buffer object - ur_mem_handle_t hBufferDst, ///< [in] handle of the dest buffer object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hBufferSrc, ///< [in][bounds(srcOrigin, region)] handle of the source buffer object + ur_mem_handle_t + hBufferDst, ///< [in][bounds(dstOrigin, region)] handle of the dest buffer object ur_rect_offset_t srcOrigin, ///< [in] 3D offset in the source buffer ur_rect_offset_t dstOrigin, ///< [in] 3D offset in the destination buffer ur_rect_region_t @@ -4472,10 +4480,11 @@ ur_result_t UR_APICALL urEnqueueMemBufferCopyRect( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object - const void *pPattern, ///< [in] pointer to the fill pattern - size_t patternSize, ///< [in] size in bytes of the pattern - size_t offset, ///< [in] offset into the buffer + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object + const void *pPattern, ///< [in] pointer to the fill pattern + size_t patternSize, ///< [in] size in bytes of the pattern + size_t offset, ///< [in] offset into the buffer size_t size, ///< [in] fill size in bytes, must be a multiple of patternSize uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -4526,7 +4535,8 @@ ur_result_t UR_APICALL urEnqueueMemBufferFill( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageRead( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingRead, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t origin, ///< [in] defines the (x,y,z) offset in pixels in the 1D, 2D, or 3D image @@ -4585,7 +4595,8 @@ ur_result_t UR_APICALL urEnqueueMemImageRead( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageWrite( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImage, ///< [in] handle of the image object + ur_mem_handle_t + hImage, ///< [in][bounds(origin, region)] handle of the image object bool blockingWrite, ///< [in] indicates blocking (true), non-blocking (false) ur_rect_offset_t @@ -4638,9 +4649,11 @@ ur_result_t UR_APICALL urEnqueueMemImageWrite( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemImageCopy( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hImageSrc, ///< [in] handle of the src image object - ur_mem_handle_t hImageDst, ///< [in] handle of the dest image object + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + ur_mem_handle_t + hImageSrc, ///< [in][bounds(srcOrigin, region)] handle of the src image object + ur_mem_handle_t + hImageDst, ///< [in][bounds(dstOrigin, region)] handle of the dest image object ur_rect_offset_t srcOrigin, ///< [in] defines the (x,y,z) offset in pixels in the source 1D, 2D, or 3D ///< image @@ -4704,7 +4717,8 @@ ur_result_t UR_APICALL urEnqueueMemImageCopy( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueMemBufferMap( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - ur_mem_handle_t hBuffer, ///< [in] handle of the buffer object + ur_mem_handle_t + hBuffer, ///< [in][bounds(offset, size)] handle of the buffer object bool blockingMap, ///< [in] indicates blocking (true), non-blocking (false) ur_map_flags_t mapFlags, ///< [in] flags for read, write, readwrite mapping size_t offset, ///< [in] offset in bytes of the buffer region being mapped @@ -4782,7 +4796,7 @@ ur_result_t UR_APICALL urEnqueueMemUnmap( /// - ::UR_RESULT_ERROR_INVALID_NULL_HANDLE /// + `NULL == hQueue` /// - ::UR_RESULT_ERROR_INVALID_NULL_POINTER -/// + `NULL == ptr` +/// + `NULL == pMem` /// + `NULL == pPattern` /// - ::UR_RESULT_ERROR_INVALID_QUEUE /// - ::UR_RESULT_ERROR_INVALID_EVENT @@ -4801,7 +4815,7 @@ ur_result_t UR_APICALL urEnqueueMemUnmap( /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueUSMFill( ur_queue_handle_t hQueue, ///< [in] handle of the queue object - void *ptr, ///< [in] pointer to USM memory object + void *pMem, ///< [in][bounds(0, size)] pointer to USM memory object size_t patternSize, ///< [in] the size in bytes of the pattern. Must be a power of 2 and less ///< than or equal to width. @@ -4851,9 +4865,11 @@ ur_result_t UR_APICALL urEnqueueUSMFill( ur_result_t UR_APICALL urEnqueueUSMMemcpy( ur_queue_handle_t hQueue, ///< [in] handle of the queue object bool blocking, ///< [in] blocking or non-blocking copy - void *pDst, ///< [in] pointer to the destination USM memory object - const void *pSrc, ///< [in] pointer to the source USM memory object - size_t size, ///< [in] size in bytes to be copied + void * + pDst, ///< [in][bounds(0, size)] pointer to the destination USM memory object + const void * + pSrc, ///< [in][bounds(0, size)] pointer to the source USM memory object + size_t size, ///< [in] size in bytes to be copied uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * phEventWaitList, ///< [in][optional][range(0, numEventsInWaitList)] pointer to a list of @@ -4900,9 +4916,10 @@ ur_result_t UR_APICALL urEnqueueUSMMemcpy( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueUSMPrefetch( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be fetched + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be fetched ur_usm_migration_flags_t flags, ///< [in] USM prefetch flags uint32_t numEventsInWaitList, ///< [in] size of the event wait list const ur_event_handle_t * @@ -4946,9 +4963,10 @@ ur_result_t UR_APICALL urEnqueueUSMPrefetch( /// - ::UR_RESULT_ERROR_OUT_OF_HOST_MEMORY /// - ::UR_RESULT_ERROR_OUT_OF_RESOURCES ur_result_t UR_APICALL urEnqueueUSMAdvise( - ur_queue_handle_t hQueue, ///< [in] handle of the queue object - const void *pMem, ///< [in] pointer to the USM memory object - size_t size, ///< [in] size in bytes to be advised + ur_queue_handle_t hQueue, ///< [in] handle of the queue object + const void + *pMem, ///< [in][bounds(0, size)] pointer to the USM memory object + size_t size, ///< [in] size in bytes to be advised ur_usm_advice_flags_t advice, ///< [in] USM memory advice ur_event_handle_t * phEvent ///< [out][optional] return an event object that identifies this particular @@ -4991,7 +5009,8 @@ ur_result_t UR_APICALL urEnqueueUSMAdvise( /// - ::UR_RESULT_ERROR_UNSUPPORTED_FEATURE ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. - void *pMem, ///< [in] pointer to memory to be filled. + void * + pMem, ///< [in][bounds(0, pitch * height)] pointer to memory to be filled. size_t pitch, ///< [in] the total width of the destination memory including padding. size_t @@ -5049,10 +5068,13 @@ ur_result_t UR_APICALL urEnqueueUSMFill2D( ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( ur_queue_handle_t hQueue, ///< [in] handle of the queue to submit to. bool blocking, ///< [in] indicates if this operation should block the host. - void *pDst, ///< [in] pointer to memory where data will be copied. + void * + pDst, ///< [in][bounds(0, dstPitch * height)] pointer to memory where data will + ///< be copied. size_t dstPitch, ///< [in] the total width of the source memory including padding. - const void *pSrc, ///< [in] pointer to memory to be copied. + const void * + pSrc, ///< [in][bounds(0, srcPitch * height)] pointer to memory to be copied. size_t srcPitch, ///< [in] the total width of the source memory including padding. size_t width, ///< [in] the width in bytes of each row to be copied. From 3276f70d5e6ced45bcc3b8967bb2b6248757ac11 Mon Sep 17 00:00:00 2001 From: Igor Chorazewicz Date: Mon, 13 Nov 2023 16:31:50 +0000 Subject: [PATCH 141/145] [UR] Enable UMF tracking by default It is needed by adapters's urUSMFree implementations where we rely on umfPoolByPtr (which always returns null if tracking is disabled). --- CMakeLists.txt | 2 +- .../kernel/kernel_adapter_level_zero.match | 1 - test/conformance/usm/usm_adapter_cuda.match | 40 +------------------ .../usm/usm_adapter_level_zero.match | 25 ------------ 4 files changed, 2 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bad7a6ca5..80a9f64ea7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ option(UR_USE_MSAN "enable MemorySanitizer" OFF) option(UR_USE_TSAN "enable ThreadSanitizer" OFF) option(UR_ENABLE_TRACING "enable api tracing through xpti" OFF) option(UMF_BUILD_SHARED_LIBRARY "Build UMF as shared library" OFF) -option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" OFF) +option(UMF_ENABLE_POOL_TRACKING "Build UMF with pool tracking" ON) option(UR_BUILD_ADAPTER_L0 "Build the Level-Zero adapter" OFF) option(UR_BUILD_ADAPTER_OPENCL "Build the OpenCL adapter" OFF) option(UR_BUILD_ADAPTER_CUDA "Build the CUDA adapter" OFF) diff --git a/test/conformance/kernel/kernel_adapter_level_zero.match b/test/conformance/kernel/kernel_adapter_level_zero.match index 8194c7ddad..2668b6821a 100644 --- a/test/conformance/kernel/kernel_adapter_level_zero.match +++ b/test/conformance/kernel/kernel_adapter_level_zero.match @@ -11,7 +11,6 @@ urKernelSetArgMemObjTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runt urKernelSetArgPointerTest.SuccessHost/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgPointerTest.SuccessDevice/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgPointerTest.SuccessShared/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urKernelSetArgPointerNegativeTest.InvalidNullHandleKernel/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgPointerNegativeTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgSamplerTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urKernelSetArgValueTest.InvalidKernelArgumentIndex/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ diff --git a/test/conformance/usm/usm_adapter_cuda.match b/test/conformance/usm/usm_adapter_cuda.match index e2ba6b6f63..15b68f5c6c 100644 --- a/test/conformance/usm/usm_adapter_cuda.match +++ b/test/conformance/usm/usm_adapter_cuda.match @@ -1,45 +1,7 @@ -urUSMDeviceAllocTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.SuccessWithDescriptors/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.InvalidNullHandleContext/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.InvalidNullHandleDevice/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.InvalidNullPtrResult/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled +{{OPT}}urUSMDeviceAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled {{OPT}}urUSMDeviceAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolDisabled -{{OPT}}urUSMDeviceAllocTest.InvalidValueAlignPowerOfTwo/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMAllocInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_ALLOC_INFO_BASE_PTR -{{OPT}}urUSMAllocInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_ALLOC_INFO_SIZE -{{OPT}}urUSMAllocInfoTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_ALLOC_INFO_POOL -{{OPT}}urUSMHostAllocTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMHostAllocTest.SuccessWithDescriptors/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMHostAllocTest.InvalidNullHandleContext/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMHostAllocTest.InvalidNullPtrMem/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled {{OPT}}urUSMHostAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled {{OPT}}urUSMHostAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolDisabled -{{OPT}}urUSMHostAllocTest.InvalidValueAlignPowerOfTwo/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMPoolCreateTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ {{OPT}}urUSMPoolCreateTest.SuccessWithFlag/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolCreateTest.InvalidNullHandleContext/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolCreateTest.InvalidNullPointerPoolDesc/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolCreateTest.InvalidNullPointerPool/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolCreateTest.InvalidEnumerationFlags/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_POOL_INFO_CONTEXT -{{OPT}}urUSMPoolGetInfoTestWithInfoParam.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_POOL_INFO_REFERENCE_COUNT -{{OPT}}urUSMPoolGetInfoTest.InvalidNullHandlePool/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolGetInfoTest.InvalidEnumerationProperty/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolGetInfoTest.InvalidSizeZero/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolGetInfoTest.InvalidSizeTooSmall/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolGetInfoTest.InvalidNullPointerPropValue/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolGetInfoTest.InvalidNullPointerPropSizeRet/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolDestroyTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolDestroyTest.InvalidNullHandleContext/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolRetainTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMPoolRetainTest.InvalidNullHandlePool/NVIDIA_CUDA_BACKEND___{{.*}}_ -{{OPT}}urUSMSharedAllocTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMSharedAllocTest.SuccessWithDescriptors/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMSharedAllocTest.SuccessWithMultipleAdvices/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMSharedAllocTest.InvalidNullHandleContext/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMSharedAllocTest.InvalidNullHandleDevice/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled -{{OPT}}urUSMSharedAllocTest.InvalidNullPtrMem/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled {{OPT}}urUSMSharedAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled {{OPT}}urUSMSharedAllocTest.InvalidUSMSize/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolDisabled -{{OPT}}urUSMSharedAllocTest.InvalidValueAlignPowerOfTwo/NVIDIA_CUDA_BACKEND___{{.*}}___UsePoolEnabled diff --git a/test/conformance/usm/usm_adapter_level_zero.match b/test/conformance/usm/usm_adapter_level_zero.match index 9e275d805e..bf45b83ec2 100644 --- a/test/conformance/usm/usm_adapter_level_zero.match +++ b/test/conformance/usm/usm_adapter_level_zero.match @@ -1,36 +1,11 @@ -urUSMDeviceAllocTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled -urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMDeviceAllocTest.SuccessWithDescriptors/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled urUSMDeviceAllocTest.InvalidUSMSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled urUSMDeviceAllocTest.InvalidUSMSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled -urUSMFreeTest.SuccessDeviceAlloc/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMFreeTest.SuccessHostAlloc/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMFreeTest.SuccessSharedAlloc/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMAllocInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_ALLOC_INFO_TYPE -urUSMAllocInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_ALLOC_INFO_BASE_PTR -urUSMAllocInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_ALLOC_INFO_SIZE -urUSMAllocInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_ALLOC_INFO_DEVICE urUSMAllocInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_ALLOC_INFO_POOL -urUSMGetMemAllocInfoTest.InvalidNullHandleContext/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMGetMemAllocInfoTest.InvalidNullPointerMem/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMGetMemAllocInfoTest.InvalidEnumeration/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMGetMemAllocInfoTest.InvalidValuePropSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMHostAllocTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMHostAllocTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled -urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMHostAllocTest.SuccessWithDescriptors/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled urUSMHostAllocTest.InvalidUSMSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled urUSMHostAllocTest.InvalidUSMSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled urUSMPoolGetInfoTestWithInfoParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_POOL_INFO_CONTEXT urUSMPoolGetInfoTestWithInfoParam.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_USM_POOL_INFO_REFERENCE_COUNT urUSMPoolGetInfoTest.InvalidSizeTooSmall/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ urUSMPoolRetainTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}_ -urUSMSharedAllocTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMSharedAllocTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled -urUSMSharedAllocTest.SuccessWithDescriptors/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMSharedAllocTest.SuccessWithDescriptors/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled -urUSMSharedAllocTest.SuccessWithMultipleAdvices/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled -urUSMSharedAllocTest.SuccessWithMultipleAdvices/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled urUSMSharedAllocTest.InvalidUSMSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolEnabled urUSMSharedAllocTest.InvalidUSMSize/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UsePoolDisabled From c01849ef81478521b6b28d43db6142299bba313e Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 29 Nov 2023 14:09:38 +0000 Subject: [PATCH 142/145] Update Adapter Change Process to use main branch --- .github/workflows/e2e_nightly.yml | 1 - .github/workflows/nightly.yml | 3 --- scripts/core/CONTRIB.rst | 4 ++-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e_nightly.yml b/.github/workflows/e2e_nightly.yml index b4cff2d1d4..eebb1f7bfa 100644 --- a/.github/workflows/e2e_nightly.yml +++ b/.github/workflows/e2e_nightly.yml @@ -30,7 +30,6 @@ jobs: - name: Checkout UR uses: actions/checkout@v4 with: - ref: adapters path: ur-repo - name: Checkout SYCL diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 527f641a51..4a81c94e8f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,9 +17,6 @@ jobs: steps: - uses: actions/checkout@v3 - # with-ref part to be removed after merging 'adapters' branch with 'main' - with: - ref: adapters - name: Install pip packages run: pip install -r third_party/requirements.txt diff --git a/scripts/core/CONTRIB.rst b/scripts/core/CONTRIB.rst index b9d4130d5a..cf2c8e870b 100644 --- a/scripts/core/CONTRIB.rst +++ b/scripts/core/CONTRIB.rst @@ -53,8 +53,8 @@ Adapter Change Process ====================== 1. Create a pull request containing the adapter changes in the - `oneapi-src/unified-runtime`_ project targeting the `adapters - `_ branch. + `oneapi-src/unified-runtime`_ project targeting the `main + `_ branch. 2. Create a draft pull request in the `intel/llvm`_ project to take advantage of the pre-merge testing. Add any required implementation changes in From 584314d313ca36b42ee8279f9826f6b3b662471a Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 26 Oct 2023 10:05:50 +0200 Subject: [PATCH 143/145] [UR][Tests] Add a CMake option to limit the test devices count and test platforms count in CTS. --- test/conformance/CMakeLists.txt | 4 +++- test/conformance/README.md | 9 ++++++++- test/conformance/cts_exe.py | 6 +++++- test/conformance/source/environment.cpp | 17 +++++++++++++++++ 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/test/conformance/CMakeLists.txt b/test/conformance/CMakeLists.txt index a4c2e8cf94..df80c02681 100644 --- a/test/conformance/CMakeLists.txt +++ b/test/conformance/CMakeLists.txt @@ -4,6 +4,8 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception set(UR_CONFORMANCE_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +option(UR_TEST_DEVICES_COUNT "Count of devices on which CTS will be run" 1) +option(UR_TEST_PLATFORMS_COUNT "Count of platforms on which CTS will be run" 1) function(add_test_adapter name adapter) set(TEST_TARGET_NAME test-${name}) @@ -12,7 +14,7 @@ function(add_test_adapter name adapter) add_test(NAME ${TEST_NAME} COMMAND ${CMAKE_COMMAND} -D TEST_FILE=${Python3_EXECUTABLE} - -D TEST_ARGS="${UR_CONFORMANCE_TEST_DIR}/cts_exe.py --test_command ${CMAKE_BINARY_DIR}/bin/${TEST_TARGET_NAME}" + -D TEST_ARGS="${UR_CONFORMANCE_TEST_DIR}/cts_exe.py --test_command ${CMAKE_BINARY_DIR}/bin/${TEST_TARGET_NAME} --test_devices_count=${UR_TEST_DEVICES_COUNT} --test_platforms_count=${UR_TEST_PLATFORMS_COUNT}" -D MODE=stdout -D MATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}_${adapter}.match -P ${PROJECT_SOURCE_DIR}/cmake/match.cmake diff --git a/test/conformance/README.md b/test/conformance/README.md index db90fc759b..9e78337151 100644 --- a/test/conformance/README.md +++ b/test/conformance/README.md @@ -8,4 +8,11 @@ In the future, when all bugs are fixed, and the tests pass, this solution will no longer be necessary. When you fix any test, the match file must be updated Empty match files indicate that there are no failing tests -in a particular group for the corresponding adapter. \ No newline at end of file +in a particular group for the corresponding adapter. + +## How to limit the test devices count + +To limit how many devices you want to run the CTS on, +use CMake option UR_TEST_DEVICES_COUNT. If you want to run +the tests on all available devices, set 0. +The default value is 1. \ No newline at end of file diff --git a/test/conformance/cts_exe.py b/test/conformance/cts_exe.py index ce3ca00a20..55ab134b07 100644 --- a/test/conformance/cts_exe.py +++ b/test/conformance/cts_exe.py @@ -20,9 +20,13 @@ parser = ArgumentParser() parser.add_argument("--test_command", help="Ctest test case") + parser.add_argument("--test_devices_count", type=str, help="Number of devices on which tests will be run") + parser.add_argument("--test_platforms_count", type=str, help="Number of platforms on which tests will be run") args = parser.parse_args() - result = subprocess.Popen([args.test_command, '--gtest_brief=1'], stdout = subprocess.PIPE, text = True) # nosec B603 + result = subprocess.Popen([args.test_command, '--gtest_brief=1', f'--devices_count={args.test_devices_count}', + f'--platforms_count={args.test_platforms_count}'], + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) # nosec B603 pat = re.compile(r'\[( )*FAILED( )*\]') output_list = [] diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index e76b84692c..6918cfb829 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -3,6 +3,7 @@ // See LICENSE.TXT // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +#include #include #include @@ -209,6 +210,22 @@ DevicesEnvironment::DevicesEnvironment(int argc, char **argv) error = "Could not find any devices associated with the platform"; return; } + // Get the argument (test_devices_count) to limit test devices count. + u_long count_set = 0; + for (int i = 1; i < argc; ++i) { + if (std::strcmp(argv[i], "--test_devices_count") == 0 && i + 1 < argc) { + count_set = std::strtoul(argv[i + 1], nullptr, 10); + break; + } + } + // In case, the count_set is "0", the variable count will not be changed. + // The CTS will run on all devices. + if (count_set > (std::numeric_limits::max)()) { + error = "Invalid test_devices_count argument"; + return; + } else if (count_set > 0) { + count = (std::min)(count, static_cast(count_set)); + } devices.resize(count); if (urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, devices.data(), nullptr)) { From 371bd3cb1d1d9f919557cf3dafc8e5765a88735b Mon Sep 17 00:00:00 2001 From: szadam Date: Wed, 22 Nov 2023 17:30:50 +0100 Subject: [PATCH 144/145] [UR][Tests] Add options in CTS to set test devices count or test device name and test platforms count or test platform name --- test/conformance/README.md | 14 +- test/conformance/source/environment.cpp | 130 ++++++++++++++---- .../testing/include/uur/environment.h | 10 ++ 3 files changed, 125 insertions(+), 29 deletions(-) diff --git a/test/conformance/README.md b/test/conformance/README.md index 9e78337151..e895a5299d 100644 --- a/test/conformance/README.md +++ b/test/conformance/README.md @@ -10,9 +10,13 @@ When you fix any test, the match file must be updated Empty match files indicate that there are no failing tests in a particular group for the corresponding adapter. -## How to limit the test devices count +## How to set test device/platform name or limit the test devices/platforms count -To limit how many devices you want to run the CTS on, -use CMake option UR_TEST_DEVICES_COUNT. If you want to run -the tests on all available devices, set 0. -The default value is 1. \ No newline at end of file +To limit how many devices/platforms you want to run the CTS on, +use CMake option UR_TEST_DEVICES_COUNT or +UR_TEST_PLATFORMS_COUNT. If you want to run the tests on +all available devices/platforms, set 0. The default value is 1. +If you run binaries for the tests, you can use the parameter +`--platforms_count=COUNT` or `--devices_count=COUNT`. +To set test device/platform name you want to run the CTS on, use +parameter `--platform=NAME` or `--device=NAME`. \ No newline at end of file diff --git a/test/conformance/source/environment.cpp b/test/conformance/source/environment.cpp index 6918cfb829..6c917914ed 100644 --- a/test/conformance/source/environment.cpp +++ b/test/conformance/source/environment.cpp @@ -42,6 +42,23 @@ std::ostream &operator<<(std::ostream &out, return out; } +std::ostream &operator<<(std::ostream &out, const ur_device_handle_t &device) { + size_t size; + urDeviceGetInfo(device, UR_DEVICE_INFO_NAME, 0, nullptr, &size); + std::vector name(size); + urDeviceGetInfo(device, UR_DEVICE_INFO_NAME, size, name.data(), nullptr); + out << name.data(); + return out; +} + +std::ostream &operator<<(std::ostream &out, + const std::vector &devices) { + for (auto device : devices) { + out << "\n * \"" << device << "\""; + } + return out; +} + uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) : platform_options{parsePlatformOptions(argc, argv)} { instance = this; @@ -101,14 +118,16 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) } if (platform_options.platform_name.empty()) { - if (platforms.size() == 1) { + + if (platforms.size() == 1 || platform_options.platforms_count == 1) { platform = platforms[0]; } else { std::stringstream ss_error; ss_error << "Select a single platform from below using the " "--platform=NAME " "command-line option:" - << platforms; + << platforms << std::endl + << "or set --platforms_count=1."; error = ss_error.str(); return; } @@ -137,7 +156,8 @@ uur::PlatformEnvironment::PlatformEnvironment(int argc, char **argv) << "\" not found. Select a single platform from below " "using the " "--platform=NAME command-line options:" - << platforms; + << platforms << std::endl + << "or set --platforms_count=1."; error = ss_error.str(); return; } @@ -178,6 +198,10 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) { arg, "--platform=", sizeof("--platform=") - 1) == 0) { options.platform_name = std::string(&arg[std::strlen("--platform=")]); + } else if (std::strncmp(arg, "--platforms_count=", + sizeof("--platforms_count=") - 1) == 0) { + options.platforms_count = std::strtoul( + &arg[std::strlen("--platforms_count=")], nullptr, 10); } } @@ -193,10 +217,31 @@ PlatformEnvironment::parsePlatformOptions(int argc, char **argv) { return options; } +DevicesEnvironment::DeviceOptions +DevicesEnvironment::parseDeviceOptions(int argc, char **argv) { + DeviceOptions options; + for (int argi = 1; argi < argc; ++argi) { + const char *arg = argv[argi]; + if (!(std::strcmp(arg, "-h") && std::strcmp(arg, "--help"))) { + // TODO - print help + break; + } else if (std::strncmp(arg, "--device=", sizeof("--device=") - 1) == + 0) { + options.device_name = std::string(&arg[std::strlen("--device=")]); + } else if (std::strncmp(arg, "--devices_count=", + sizeof("--devices_count=") - 1) == 0) { + options.devices_count = std::strtoul( + &arg[std::strlen("--devices_count=")], nullptr, 10); + } + } + return options; +} + DevicesEnvironment *DevicesEnvironment::instance = nullptr; DevicesEnvironment::DevicesEnvironment(int argc, char **argv) - : PlatformEnvironment(argc, argv) { + : PlatformEnvironment(argc, argv), + device_options(parseDeviceOptions(argc, argv)) { instance = this; if (!error.empty()) { return; @@ -210,27 +255,64 @@ DevicesEnvironment::DevicesEnvironment(int argc, char **argv) error = "Could not find any devices associated with the platform"; return; } - // Get the argument (test_devices_count) to limit test devices count. - u_long count_set = 0; - for (int i = 1; i < argc; ++i) { - if (std::strcmp(argv[i], "--test_devices_count") == 0 && i + 1 < argc) { - count_set = std::strtoul(argv[i + 1], nullptr, 10); - break; - } - } - // In case, the count_set is "0", the variable count will not be changed. + + // Get the argument (devices_count) to limit test devices count. + // In case, the devices_count is "0", the variable count will not be changed. // The CTS will run on all devices. - if (count_set > (std::numeric_limits::max)()) { - error = "Invalid test_devices_count argument"; - return; - } else if (count_set > 0) { - count = (std::min)(count, static_cast(count_set)); - } - devices.resize(count); - if (urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, devices.data(), - nullptr)) { - error = "urDeviceGet() failed to get devices."; - return; + if (device_options.device_name.empty()) { + if (device_options.devices_count > + (std::numeric_limits::max)()) { + error = "Invalid devices_count argument"; + return; + } else if (device_options.devices_count > 0) { + count = (std::min)( + count, static_cast(device_options.devices_count)); + } + devices.resize(count); + if (urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, devices.data(), + nullptr)) { + error = "urDeviceGet() failed to get devices."; + return; + } + } else { + devices.resize(count); + if (urDeviceGet(platform, UR_DEVICE_TYPE_ALL, count, devices.data(), + nullptr)) { + error = "urDeviceGet() failed to get devices."; + return; + } + for (u_long i = 0; i < count; i++) { + size_t size; + if (urDeviceGetInfo(devices[i], UR_DEVICE_INFO_NAME, 0, nullptr, + &size)) { + error = "urDeviceGetInfo() failed"; + return; + } + std::vector device_name(size); + if (urDeviceGetInfo(devices[i], UR_DEVICE_INFO_NAME, size, + device_name.data(), nullptr)) { + error = "urDeviceGetInfo() failed"; + return; + } + if (device_options.device_name == device_name.data()) { + device = devices[i]; + devices.clear(); + devices.resize(1); + devices[0] = device; + break; + } + } + if (!device) { + std::stringstream ss_error; + ss_error << "Device \"" << device_options.device_name + << "\" not found. Select a single device from below " + "using the " + "--device=NAME command-line options:" + << devices << std::endl + << "or set --devices_count=COUNT."; + error = ss_error.str(); + return; + } } } diff --git a/test/conformance/testing/include/uur/environment.h b/test/conformance/testing/include/uur/environment.h index 5cc6756364..551be76e17 100644 --- a/test/conformance/testing/include/uur/environment.h +++ b/test/conformance/testing/include/uur/environment.h @@ -17,6 +17,7 @@ struct PlatformEnvironment : ::testing::Environment { struct PlatformOptions { std::string platform_name; + unsigned long platforms_count; }; PlatformEnvironment(int argc, char **argv); @@ -36,17 +37,26 @@ struct PlatformEnvironment : ::testing::Environment { struct DevicesEnvironment : PlatformEnvironment { + struct DeviceOptions { + std::string device_name; + unsigned long devices_count; + }; + DevicesEnvironment(int argc, char **argv); virtual ~DevicesEnvironment() override = default; virtual void SetUp() override; virtual void TearDown() override; + DeviceOptions parseDeviceOptions(int argc, char **argv); + inline const std::vector &GetDevices() const { return devices; } + DeviceOptions device_options; std::vector devices; + ur_device_handle_t device = nullptr; static DevicesEnvironment *instance; }; From 1ec152ef8ae1d31589042b778166e69be81a1009 Mon Sep 17 00:00:00 2001 From: PietroGhg Date: Thu, 7 Dec 2023 13:18:00 +0000 Subject: [PATCH 145/145] Use static_cast in switch for ur_device_info_t --- source/adapters/native_cpu/device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/adapters/native_cpu/device.cpp b/source/adapters/native_cpu/device.cpp index 78540a1b90..a72d3032fb 100644 --- a/source/adapters/native_cpu/device.cpp +++ b/source/adapters/native_cpu/device.cpp @@ -60,7 +60,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice, UR_ASSERT(hDevice, UR_RESULT_ERROR_INVALID_NULL_HANDLE); UrReturnHelper ReturnValue(propSize, pPropValue, pPropSizeRet); - switch (propName) { + switch (static_cast(propName)) { case UR_DEVICE_INFO_TYPE: return ReturnValue(UR_DEVICE_TYPE_CPU); case UR_DEVICE_INFO_PARENT_DEVICE: