diff --git a/cmake/match.py b/cmake/match.py index c07cfbc384..3f3f4faff3 100755 --- a/cmake/match.py +++ b/cmake/match.py @@ -5,77 +5,132 @@ # See LICENSE.TXT # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -# check if all lines match in a file -# lines in a match file can contain regex inside of double curly braces {{}} +# Check if all input file content matches match file content. +# Lines in a match file can contain regex inside of double curly braces {{}}. +# Regex patterns are limited to single line. +# +# List of available special tags: +# {{OPT}} - makes content in the same line as the tag optional +# {{IGNORE}} - ignores all content until the next successfully matched line or the end of the input +# Special tags are mutually exclusive and are expected to be located at the start of a line. +# +import os import sys import re +from enum import Enum ## @brief print the whole content of input and match files -def print_content(input_lines, match_lines): +def print_content(input_lines, match_lines, ignored_lines): print("--- Input Lines " + "-" * 64) print("".join(input_lines).strip()) print("--- Match Lines " + "-" * 64) print("".join(match_lines).strip()) + print("--- Ignored Lines " + "-" * 62) + print("".join(ignored_lines).strip()) print("-" * 80) -if len(sys.argv) != 3: - print("Usage: python match.py ") - sys.exit(1) - -input_file = sys.argv[1] -match_file = sys.argv[2] - -with open(input_file, 'r') as input, open(match_file, 'r') as match: - input_lines = input.readlines() - match_lines = match.readlines() - -if len(match_lines) < len(input_lines): - print(f"Match length < input length (input: {len(input_lines)}, match: {len(match_lines)})") - print_content(input_lines, match_lines) - sys.exit(1) - -input_idx = 0 -opt = "{{OPT}}" -for i, match_line in enumerate(match_lines): - if match_line.startswith(opt): - optional_line = True - match_line = match_line[len(opt):] - else: - optional_line = False - - # split into parts at {{ }} - match_parts = re.split(r'\{{(.*?)\}}', match_line.strip()) - pattern = "" - for j, part in enumerate(match_parts): - if j % 2 == 0: - pattern += re.escape(part) - else: - pattern += part +## @brief print the incorrect match line +def print_incorrect_match(match_line, present, expected): + print("Line " + str(match_line) + " does not match") + print("is: " + present) + print("expected: " + expected) - # empty input file or end of input file, from now on match file must be optional - if not input_lines: - if optional_line is True: - continue - else: - print("End of input file or empty file.") - print("expected: " + match_line.strip()) + +## @brief pattern matching script status values +class Status(Enum): + INPUT_END = 1 + MATCH_END = 2 + INPUT_AND_MATCH_END = 3 + PROCESSING = 4 + + +## @brief check matching script status +def check_status(input_lines, match_lines): + if not input_lines and not match_lines: + return Status.INPUT_AND_MATCH_END + elif not input_lines: + return Status.INPUT_END + elif not match_lines: + return Status.MATCH_END + return Status.PROCESSING + + +## @brief pattern matching tags. +## Tags are expected to be at the start of the line. +class Tag(Enum): + OPT = "{{OPT}}" # makes the line optional + IGNORE = "{{IGNORE}}" # ignores all input until next match or end of input file + + +## @brief main function for the match file processing script +def main(): + if len(sys.argv) != 3: + print("Usage: python match.py ") + sys.exit(1) + + input_file = sys.argv[1] + match_file = sys.argv[2] + + with open(input_file, 'r') as input, open(match_file, 'r') as match: + input_lines = input.readlines() + match_lines = match.readlines() + + ignored_lines = [] + + input_idx = 0 + match_idx = 0 + tags_in_effect = [] + while True: + # check file status + status = check_status(input_lines[input_idx:], match_lines[match_idx:]) + if (status == Status.INPUT_AND_MATCH_END) or (status == Status.MATCH_END and Tag.IGNORE in tags_in_effect): + # all lines matched or the last line in match file is an ignore tag + sys.exit(0) + elif status == Status.MATCH_END: + print_incorrect_match(match_idx + 1, input_lines[input_idx].strip(), ""); + print_content(input_lines, match_lines, ignored_lines) sys.exit(1) - input_line = input_lines[input_idx].strip() - if not re.fullmatch(pattern, input_line): - if optional_line is True: - continue + input_line = input_lines[input_idx].strip() if input_idx < len(input_lines) else "" + match_line = match_lines[match_idx] + + # check for tags + if match_line.startswith(Tag.OPT.value): + tags_in_effect.append(Tag.OPT) + match_line = match_line[len(Tag.OPT.value):] + elif match_line.startswith(Tag.IGNORE.value): + tags_in_effect.append(Tag.IGNORE) + match_idx += 1 + continue # line with ignore tag should be skipped + + # split into parts at {{ }} + match_parts = re.split(r'\{{(.*?)\}}', match_line.strip()) + pattern = "" + for j, part in enumerate(match_parts): + if j % 2 == 0: + pattern += re.escape(part) + else: + pattern += part + + # match or process tags + if re.fullmatch(pattern, input_line): + input_idx += 1 + match_idx += 1 + tags_in_effect = [] + elif Tag.OPT in tags_in_effect: + match_idx += 1 + tags_in_effect.remove(Tag.OPT) + elif Tag.IGNORE in tags_in_effect: + ignored_lines.append(input_line + os.linesep) + input_idx += 1 else: - print("Line " + str(i+1) + " does not match") - print("is: " + input_line) - print("expected: " + match_line.strip()) - print_content(input_lines, match_lines) + print_incorrect_match(match_idx + 1, input_line, match_line.strip()) + print_content(input_lines, match_lines, ignored_lines) sys.exit(1) - else: - if (input_idx == len(input_lines) - 1): - input_lines = [] - else: - input_idx += 1 + + +if __name__ == "__main__": + main() diff --git a/include/ur_api.h b/include/ur_api.h index 5c9c7af5da..255ed5d0b9 100644 --- a/include/ur_api.h +++ b/include/ur_api.h @@ -3235,13 +3235,16 @@ typedef enum ur_usm_advice_flag_t { UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_HOST = UR_BIT(12), ///< Removes the affect of ::UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_HOST UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST = UR_BIT(13), ///< Hint that the preferred memory location is the host UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST = UR_BIT(14), ///< Removes the affect of ::UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST + UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY = UR_BIT(15), ///< Hint that memory coherence will be coarse-grained (up-to-date only at + ///< kernel boundaries) + UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY = UR_BIT(16), ///< Removes the affect of ::UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY /// @cond UR_USM_ADVICE_FLAG_FORCE_UINT32 = 0x7fffffff /// @endcond } ur_usm_advice_flag_t; /// @brief Bit Mask for validating ur_usm_advice_flags_t -#define UR_USM_ADVICE_FLAGS_MASK 0xffff8000 +#define UR_USM_ADVICE_FLAGS_MASK 0xfffe0000 /////////////////////////////////////////////////////////////////////////////// /// @brief Handle of USM pool diff --git a/include/ur_print.hpp b/include/ur_print.hpp index 70e5b9886d..893e82ef19 100644 --- a/include/ur_print.hpp +++ b/include/ur_print.hpp @@ -6277,6 +6277,12 @@ inline std::ostream &operator<<(std::ostream &os, ur_usm_advice_flag_t value) { case UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST: os << "UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST"; break; + case UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY: + os << "UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY"; + break; + case UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY: + os << "UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY"; + break; default: os << "unknown enumerator"; break; @@ -6441,6 +6447,26 @@ inline ur_result_t printFlag(std::ostream &os, uint32_t fl } os << UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION_HOST; } + + if ((val & UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY) == (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY; + } + + if ((val & UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY) == (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY) { + val ^= (uint32_t)UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY; + if (!first) { + os << " | "; + } else { + first = false; + } + os << UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY; + } if (val != 0) { std::bitset<32> bits(val); if (!first) { diff --git a/scripts/core/usm.yml b/scripts/core/usm.yml index 1476eec34a..68031ddaf8 100644 --- a/scripts/core/usm.yml +++ b/scripts/core/usm.yml @@ -126,6 +126,12 @@ etors: - name: CLEAR_PREFERRED_LOCATION_HOST value: "$X_BIT(14)" desc: "Removes the affect of $X_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION_HOST" + - name: SET_NON_COHERENT_MEMORY + value: "$X_BIT(15)" + desc: "Hint that memory coherence will be coarse-grained (up-to-date only at kernel boundaries)" + - name: CLEAR_NON_COHERENT_MEMORY + value: "$X_BIT(16)" + desc: "Removes the affect of $X_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY" --- #-------------------------------------------------------------------------- type: handle desc: "Handle of USM pool" diff --git a/source/adapters/hip/enqueue.cpp b/source/adapters/hip/enqueue.cpp index 68e3e665d2..e7acfe7c6f 100644 --- a/source/adapters/hip/enqueue.cpp +++ b/source/adapters/hip/enqueue.cpp @@ -92,30 +92,46 @@ ur_result_t setHipMemAdvise(const void *DevPtr, const size_t Size, if (URAdviceFlags & (UR_USM_ADVICE_FLAG_SET_NON_ATOMIC_MOSTLY | UR_USM_ADVICE_FLAG_CLEAR_NON_ATOMIC_MOSTLY | - UR_USM_ADVICE_FLAG_BIAS_CACHED | UR_USM_ADVICE_FLAG_BIAS_UNCACHED)) { + UR_USM_ADVICE_FLAG_BIAS_CACHED | UR_USM_ADVICE_FLAG_BIAS_UNCACHED +#if !defined(__HIP_PLATFORM_AMD__) + | UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY | + UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY +#endif + )) { return UR_RESULT_ERROR_INVALID_ENUMERATION; } using ur_to_hip_advice_t = std::pair; - static constexpr std::array - URToHIPMemAdviseDeviceFlags{ - std::make_pair(UR_USM_ADVICE_FLAG_SET_READ_MOSTLY, - hipMemAdviseSetReadMostly), - std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY, - hipMemAdviseUnsetReadMostly), - std::make_pair(UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION, - hipMemAdviseSetPreferredLocation), - std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION, - hipMemAdviseUnsetPreferredLocation), - std::make_pair(UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE, - hipMemAdviseSetAccessedBy), - std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE, - hipMemAdviseUnsetAccessedBy), - }; - for (auto &FlagPair : URToHIPMemAdviseDeviceFlags) { - if (URAdviceFlags & FlagPair.first) { - UR_CHECK_ERROR(hipMemAdvise(DevPtr, Size, FlagPair.second, Device)); +#if defined(__HIP_PLATFORM_AMD__) + constexpr size_t DeviceFlagCount = 8; +#else + constexpr size_t DeviceFlagCount = 6; +#endif + static constexpr std::array + URToHIPMemAdviseDeviceFlags { + std::make_pair(UR_USM_ADVICE_FLAG_SET_READ_MOSTLY, + hipMemAdviseSetReadMostly), + std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_READ_MOSTLY, + hipMemAdviseUnsetReadMostly), + std::make_pair(UR_USM_ADVICE_FLAG_SET_PREFERRED_LOCATION, + hipMemAdviseSetPreferredLocation), + std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_PREFERRED_LOCATION, + hipMemAdviseUnsetPreferredLocation), + std::make_pair(UR_USM_ADVICE_FLAG_SET_ACCESSED_BY_DEVICE, + hipMemAdviseSetAccessedBy), + std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_ACCESSED_BY_DEVICE, + hipMemAdviseUnsetAccessedBy), +#if defined(__HIP_PLATFORM_AMD__) + std::make_pair(UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY, + hipMemAdviseSetCoarseGrain), + std::make_pair(UR_USM_ADVICE_FLAG_CLEAR_NON_COHERENT_MEMORY, + hipMemAdviseUnsetCoarseGrain), +#endif + }; + for (const auto &[URAdvice, HIPAdvice] : URToHIPMemAdviseDeviceFlags) { + if (URAdviceFlags & URAdvice) { + UR_CHECK_ERROR(hipMemAdvise(DevPtr, Size, HIPAdvice, Device)); } } @@ -130,10 +146,9 @@ ur_result_t setHipMemAdvise(const void *DevPtr, const size_t Size, hipMemAdviseUnsetAccessedBy), }; - for (auto &FlagPair : URToHIPMemAdviseHostFlags) { - if (URAdviceFlags & FlagPair.first) { - UR_CHECK_ERROR( - hipMemAdvise(DevPtr, Size, FlagPair.second, hipCpuDeviceId)); + for (const auto &[URAdvice, HIPAdvice] : URToHIPMemAdviseHostFlags) { + if (URAdviceFlags & URAdvice) { + UR_CHECK_ERROR(hipMemAdvise(DevPtr, Size, HIPAdvice, hipCpuDeviceId)); } } @@ -1615,6 +1630,10 @@ urEnqueueUSMAdvise(ur_queue_handle_t hQueue, const void *pMem, size_t size, pMem, size, hipMemAdviseUnsetPreferredLocation, DeviceID)); UR_CHECK_ERROR( hipMemAdvise(pMem, size, hipMemAdviseUnsetAccessedBy, DeviceID)); +#if defined(__HIP_PLATFORM_AMD__) + UR_CHECK_ERROR( + hipMemAdvise(pMem, size, hipMemAdviseUnsetCoarseGrain, DeviceID)); +#endif } else { Result = setHipMemAdvise(HIPDevicePtr, size, advice, DeviceID); // UR_RESULT_ERROR_INVALID_ENUMERATION is returned when using a valid but @@ -1697,16 +1716,67 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( return Result; } +namespace { + +enum class GlobalVariableCopy { Read, Write }; + +ur_result_t deviceGlobalCopyHelper( + ur_queue_handle_t hQueue, ur_program_handle_t hProgram, const char *name, + bool blocking, size_t count, size_t offset, void *ptr, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent, GlobalVariableCopy CopyType) { + // Since HIP requires a the global variable to be referenced by name, we use + // metadata to find the correct name to access it by. + auto DeviceGlobalNameIt = hProgram->GlobalIDMD.find(name); + if (DeviceGlobalNameIt == hProgram->GlobalIDMD.end()) + return UR_RESULT_ERROR_INVALID_VALUE; + std::string DeviceGlobalName = DeviceGlobalNameIt->second; + + try { + hipDeviceptr_t DeviceGlobal = 0; + size_t DeviceGlobalSize = 0; + UR_CHECK_ERROR(hipModuleGetGlobal(&DeviceGlobal, &DeviceGlobalSize, + hProgram->get(), + DeviceGlobalName.c_str())); + + if (offset + count > DeviceGlobalSize) + return UR_RESULT_ERROR_INVALID_VALUE; + + void *pSrc, *pDst; + if (CopyType == GlobalVariableCopy::Write) { + pSrc = ptr; + pDst = reinterpret_cast(DeviceGlobal) + offset; + } else { + pSrc = reinterpret_cast(DeviceGlobal) + offset; + pDst = ptr; + } + return urEnqueueUSMMemcpy(hQueue, blocking, pDst, pSrc, count, + numEventsInWaitList, phEventWaitList, phEvent); + } catch (ur_result_t Err) { + return Err; + } +} +} // namespace + UR_APIEXPORT ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableWrite( - ur_queue_handle_t, ur_program_handle_t, const char *, bool, size_t, size_t, - const void *, uint32_t, const ur_event_handle_t *, ur_event_handle_t *) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + ur_queue_handle_t hQueue, ur_program_handle_t hProgram, const char *name, + bool blockingWrite, size_t count, size_t offset, const void *pSrc, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { + return deviceGlobalCopyHelper(hQueue, hProgram, name, blockingWrite, count, + offset, const_cast(pSrc), + numEventsInWaitList, phEventWaitList, phEvent, + GlobalVariableCopy::Write); } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueDeviceGlobalVariableRead( - ur_queue_handle_t, ur_program_handle_t, const char *, bool, size_t, size_t, - void *, uint32_t, const ur_event_handle_t *, ur_event_handle_t *) { - return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + ur_queue_handle_t hQueue, ur_program_handle_t hProgram, const char *name, + bool blockingRead, size_t count, size_t offset, void *pDst, + uint32_t numEventsInWaitList, const ur_event_handle_t *phEventWaitList, + ur_event_handle_t *phEvent) { + return deviceGlobalCopyHelper( + hQueue, hProgram, name, blockingRead, count, offset, pDst, + numEventsInWaitList, phEventWaitList, phEvent, GlobalVariableCopy::Read); } UR_APIEXPORT ur_result_t UR_APICALL urEnqueueReadHostPipe( diff --git a/source/adapters/hip/memory.cpp b/source/adapters/hip/memory.cpp index 68ded26263..6a220f53c4 100644 --- a/source/adapters/hip/memory.cpp +++ b/source/adapters/hip/memory.cpp @@ -458,9 +458,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemRetain(ur_mem_handle_t hMem) { return UR_RESULT_SUCCESS; } -inline ur_result_t -allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t Mem, - const ur_device_handle_t hDevice) { +ur_result_t allocateMemObjOnDeviceIfNeeded(ur_mem_handle_t Mem, + const ur_device_handle_t hDevice) { ScopedContext Active(hDevice); ur_lock LockGuard(Mem->MemoryAllocationMutex); diff --git a/source/adapters/hip/program.cpp b/source/adapters/hip/program.cpp index 9aa64151e0..81f1be1194 100644 --- a/source/adapters/hip/program.cpp +++ b/source/adapters/hip/program.cpp @@ -78,6 +78,15 @@ void getCoMgrBuildLog(const amd_comgr_data_set_t BuildDataSet, char *BuildLog, } // namespace #endif +std::pair +splitMetadataName(const std::string &metadataName) { + size_t splitPos = metadataName.rfind('@'); + if (splitPos == std::string::npos) + return std::make_pair(metadataName, std::string{}); + return std::make_pair(metadataName.substr(0, splitPos), + metadataName.substr(splitPos, metadataName.length())); +} + ur_result_t ur_program_handle_t_::setMetadata(const ur_program_metadata_t *Metadata, size_t Length) { @@ -85,10 +94,19 @@ ur_program_handle_t_::setMetadata(const ur_program_metadata_t *Metadata, const ur_program_metadata_t MetadataElement = Metadata[i]; std::string MetadataElementName{MetadataElement.pName}; + auto [Prefix, Tag] = splitMetadataName(MetadataElementName); + if (MetadataElementName == __SYCL_UR_PROGRAM_METADATA_TAG_NEED_FINALIZATION) { assert(MetadataElement.type == UR_PROGRAM_METADATA_TYPE_UINT32); IsRelocatable = MetadataElement.value.data32; + } else if (Tag == __SYCL_UR_PROGRAM_METADATA_GLOBAL_ID_MAPPING) { + const char *MetadataValPtr = + reinterpret_cast(MetadataElement.value.pData) + + sizeof(std::uint64_t); + const char *MetadataValPtrEnd = + MetadataValPtr + MetadataElement.size - sizeof(std::uint64_t); + GlobalIDMD[Prefix] = std::string{MetadataValPtr, MetadataValPtrEnd}; } } return UR_RESULT_SUCCESS; diff --git a/source/adapters/hip/program.hpp b/source/adapters/hip/program.hpp index 4b4e5ec878..dbdf9c55c6 100644 --- a/source/adapters/hip/program.hpp +++ b/source/adapters/hip/program.hpp @@ -29,6 +29,8 @@ struct ur_program_handle_t_ { // Metadata bool IsRelocatable = false; + std::unordered_map GlobalIDMD; + constexpr static size_t MAX_LOG_SIZE = 8192u; char ErrorLog[MAX_LOG_SIZE], InfoLog[MAX_LOG_SIZE]; diff --git a/source/adapters/level_zero/command_buffer.cpp b/source/adapters/level_zero/command_buffer.cpp index 4b811ab033..bbe49cb705 100644 --- a/source/adapters/level_zero/command_buffer.cpp +++ b/source/adapters/level_zero/command_buffer.cpp @@ -45,13 +45,13 @@ │ Prefix │ Commands added to UR command-buffer by UR user │ Suffix │ └──────────┴────────────────────────────────────────────────┴─────────┘ - ┌───────────────────┬──────────────────────────────┐ - Prefix │Reset signal event │ Barrier waiting on wait event│ - └───────────────────┴──────────────────────────────┘ + ┌───────────────────┬──────────────┐──────────────────────────────┐ + Prefix │Reset signal event │ Reset events │ Barrier waiting on wait event│ + └───────────────────┴──────────────┘──────────────────────────────┘ ┌─────────────────────────────────────────────┐──────────────┐ - Suffix │Barrier waiting on sync-point event, │ Reset events │ - │signalling the UR command-buffer signal event│ │ + Suffix │Barrier waiting on sync-point event, │ Query CMD │ + │signalling the UR command-buffer signal event│ Timestamps │ └─────────────────────────────────────────────┘──────────────┘ For a call to `urCommandBufferEnqueueExp` with an event_list `EL`, @@ -433,6 +433,10 @@ urCommandBufferCreateExp(ur_context_handle_t Context, ur_device_handle_t Device, ZeStruct ZeCommandListDesc; ZeCommandListDesc.commandQueueGroupOrdinal = QueueGroupOrdinal; + // Dependencies between commands are explicitly enforced by sync points when + // enqueuing. Consequently, relax the command ordering in the command list + // can enable the backend to further optimize the workload + ZeCommandListDesc.flags = ZE_COMMAND_LIST_FLAG_RELAXED_ORDERING; ze_command_list_handle_t ZeCommandList; // TODO We could optimize this by pooling both Level Zero command-lists and UR @@ -494,18 +498,6 @@ urCommandBufferFinalizeExp(ur_exp_command_buffer_handle_t CommandBuffer) { (CommandBuffer->ZeCommandList, CommandBuffer->SignalEvent->ZeEvent, NumEvents, WaitEventList.data())); - // Reset the wait-event for the UR command-buffer that is signalled when its - // submission dependencies have been satisfied. - ZE2UR_CALL(zeCommandListAppendEventReset, - (CommandBuffer->ZeCommandList, CommandBuffer->WaitEvent->ZeEvent)); - - // Reset the L0 events we use for command-buffer internal sync-points to the - // non-signalled state - for (auto Event : WaitEventList) { - ZE2UR_CALL(zeCommandListAppendEventReset, - (CommandBuffer->ZeCommandList, Event)); - } - // Close the command list and have it ready for dispatch. ZE2UR_CALL(zeCommandListClose, (CommandBuffer->ZeCommandList)); return UR_RESULT_SUCCESS; @@ -899,14 +891,28 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( // Create command-list to execute before `CommandListPtr` and will signal // when `EventWaitList` dependencies are complete. ur_command_list_ptr_t WaitCommandList{}; + UR_CALL(Queue->Context->getAvailableCommandList(Queue, WaitCommandList, false, + false)); + + // Create a list of events of all the events that compose the command buffer + // workload. + // This loop also resets the L0 events we use for command-buffer internal + // sync-points to the non-signalled state. + // This is required for multiple submissions. + const size_t NumEvents = CommandBuffer->SyncPoints.size(); + std::vector WaitEventList{NumEvents}; + for (size_t i = 0; i < NumEvents; i++) { + auto ZeEvent = CommandBuffer->SyncPoints[i]->ZeEvent; + WaitEventList[i] = ZeEvent; + ZE2UR_CALL(zeCommandListAppendEventReset, + (WaitCommandList->first, ZeEvent)); + } + if (NumEventsInWaitList) { _ur_ze_event_list_t TmpWaitList; UR_CALL(TmpWaitList.createAndRetainUrZeEventList( NumEventsInWaitList, EventWaitList, Queue, UseCopyEngine)); - UR_CALL(Queue->Context->getAvailableCommandList(Queue, WaitCommandList, - false, false)) - // Update the WaitList of the Wait Event // Events are appended to the WaitList if the WaitList is not empty if (CommandBuffer->WaitEvent->WaitList.isEmpty()) @@ -919,9 +925,6 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( CommandBuffer->WaitEvent->WaitList.Length, CommandBuffer->WaitEvent->WaitList.ZeEventList)); } else { - UR_CALL(Queue->Context->getAvailableCommandList(Queue, WaitCommandList, - false, false)); - ZE2UR_CALL(zeCommandListAppendSignalEvent, (WaitCommandList->first, CommandBuffer->WaitEvent->ZeEvent)); } @@ -930,17 +933,43 @@ UR_APIEXPORT ur_result_t UR_APICALL urCommandBufferEnqueueExp( ur_event_handle_t RetEvent{}; // Create a command-list to signal RetEvent on completion ur_command_list_ptr_t SignalCommandList{}; - if (Event) { - UR_CALL(Queue->Context->getAvailableCommandList(Queue, SignalCommandList, - false, false)); + UR_CALL(Queue->Context->getAvailableCommandList(Queue, SignalCommandList, + false, false)); + // Reset the wait-event for the UR command-buffer that is signalled when its + // submission dependencies have been satisfied. + ZE2UR_CALL(zeCommandListAppendEventReset, + (SignalCommandList->first, CommandBuffer->WaitEvent->ZeEvent)); + if (Event) { UR_CALL(createEventAndAssociateQueue(Queue, &RetEvent, UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP, SignalCommandList, false)); - ZE2UR_CALL(zeCommandListAppendBarrier, - (SignalCommandList->first, RetEvent->ZeEvent, 1, - &(CommandBuffer->SignalEvent->ZeEvent))); + if ((Queue->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE)) { + // Multiple submissions of a command buffer implies that we need to save + // the event timestamps before resubmiting the command buffer. We + // therefore copy the these timestamps in a dedicated USM memory section + // before completing the command buffer execution, and then attach this + // memory to the event returned to users to allow to allow the profiling + // engine to recover these timestamps. + command_buffer_profiling_t *Profiling = new command_buffer_profiling_t(); + + Profiling->NumEvents = WaitEventList.size(); + Profiling->Timestamps = + new ze_kernel_timestamp_result_t[Profiling->NumEvents]; + + ZE2UR_CALL(zeCommandListAppendQueryKernelTimestamps, + (SignalCommandList->first, WaitEventList.size(), + WaitEventList.data(), (void *)Profiling->Timestamps, 0, + RetEvent->ZeEvent, 1, + &(CommandBuffer->SignalEvent->ZeEvent))); + + RetEvent->CommandData = static_cast(Profiling); + } else { + ZE2UR_CALL(zeCommandListAppendBarrier, + (SignalCommandList->first, RetEvent->ZeEvent, 1, + &(CommandBuffer->SignalEvent->ZeEvent))); + } } // Execution our command-lists asynchronously diff --git a/source/adapters/level_zero/command_buffer.hpp b/source/adapters/level_zero/command_buffer.hpp index b18f1c3497..a43e9e4c52 100644 --- a/source/adapters/level_zero/command_buffer.hpp +++ b/source/adapters/level_zero/command_buffer.hpp @@ -19,6 +19,11 @@ #include "context.hpp" #include "queue.hpp" +struct command_buffer_profiling_t { + ur_exp_command_buffer_sync_point_t NumEvents; + ze_kernel_timestamp_result_t *Timestamps; +}; + struct ur_exp_command_buffer_handle_t_ : public _ur_object { ur_exp_command_buffer_handle_t_(ur_context_handle_t Context, ur_device_handle_t Device, diff --git a/source/adapters/level_zero/event.cpp b/source/adapters/level_zero/event.cpp index d8af1e674d..2dc74ff5ac 100644 --- a/source/adapters/level_zero/event.cpp +++ b/source/adapters/level_zero/event.cpp @@ -13,6 +13,7 @@ #include #include +#include "command_buffer.hpp" #include "common.hpp" #include "event.hpp" #include "ur_level_zero.hpp" @@ -454,6 +455,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo( ///< bytes returned in propValue ) { std::shared_lock EventLock(Event->Mutex); + if (Event->UrQueue && (Event->UrQueue->Properties & UR_QUEUE_FLAG_PROFILING_ENABLE) == 0) { return UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE; @@ -470,6 +472,70 @@ UR_APIEXPORT ur_result_t UR_APICALL urEventGetProfilingInfo( ze_kernel_timestamp_result_t tsResult; + // A Command-buffer consists of three command-lists for which only a single + // event is returned to users. The actual profiling information related to the + // command-buffer should therefore be extrated from graph events themsleves. + // The timestamps of these events are saved in a memory region attached to + // event usning CommandData field. The timings must therefore be recovered + // from this memory. + if (Event->CommandType == UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP) { + if (Event->CommandData) { + command_buffer_profiling_t *ProfilingsPtr; + switch (PropName) { + case UR_PROFILING_INFO_COMMAND_START: { + ProfilingsPtr = + static_cast(Event->CommandData); + // Sync-point order does not necessarily match to the order of + // execution. We therefore look for the first command executed. + uint64_t MinStart = ProfilingsPtr->Timestamps[0].global.kernelStart; + for (uint64_t i = 1; i < ProfilingsPtr->NumEvents; i++) { + uint64_t Timestamp = ProfilingsPtr->Timestamps[i].global.kernelStart; + if (Timestamp < MinStart) { + MinStart = Timestamp; + } + } + uint64_t ContextStartTime = + (MinStart & TimestampMaxValue) * ZeTimerResolution; + return ReturnValue(ContextStartTime); + } + case UR_PROFILING_INFO_COMMAND_END: { + ProfilingsPtr = + static_cast(Event->CommandData); + // Sync-point order does not necessarily match to the order of + // execution. We therefore look for the last command executed. + uint64_t MaxEnd = ProfilingsPtr->Timestamps[0].global.kernelEnd; + uint64_t LastStart = ProfilingsPtr->Timestamps[0].global.kernelStart; + for (uint64_t i = 1; i < ProfilingsPtr->NumEvents; i++) { + uint64_t Timestamp = ProfilingsPtr->Timestamps[i].global.kernelEnd; + if (Timestamp > MaxEnd) { + MaxEnd = Timestamp; + LastStart = ProfilingsPtr->Timestamps[i].global.kernelStart; + } + } + uint64_t ContextStartTime = (LastStart & TimestampMaxValue); + uint64_t ContextEndTime = (MaxEnd & TimestampMaxValue); + + // + // Handle a possible wrap-around (the underlying HW counter is < + // 64-bit). Note, it will not report correct time if there were multiple + // wrap arounds, and the longer term plan is to enlarge the capacity of + // the HW timestamps. + // + if (ContextEndTime <= ContextStartTime) { + ContextEndTime += TimestampMaxValue; + } + ContextEndTime *= ZeTimerResolution; + return ReturnValue(ContextEndTime); + } + default: + urPrint("urEventGetProfilingInfo: not supported ParamName\n"); + return UR_RESULT_ERROR_INVALID_VALUE; + } + } else { + return UR_RESULT_ERROR_PROFILING_INFO_NOT_AVAILABLE; + } + } + switch (PropName) { case UR_PROFILING_INFO_COMMAND_START: { ZE2UR_CALL(zeEventQueryKernelTimestamp, (Event->ZeEvent, &tsResult)); @@ -763,6 +829,15 @@ ur_result_t urEventReleaseInternal(ur_event_handle_t Event) { return Res; Event->CommandData = nullptr; } + if (Event->CommandType == UR_COMMAND_COMMAND_BUFFER_ENQUEUE_EXP && + Event->CommandData) { + // Free the memory extra event allocated for profiling purposed. + command_buffer_profiling_t *ProfilingPtr = + static_cast(Event->CommandData); + delete[] ProfilingPtr->Timestamps; + delete ProfilingPtr; + Event->CommandData = nullptr; + } if (Event->OwnNativeHandle) { if (DisableEventsCaching) { auto ZeResult = ZE_CALL_NOCHECK(zeEventDestroy, (Event->ZeEvent)); diff --git a/test/conformance/enqueue/enqueue_adapter_cuda.match b/test/conformance/enqueue/enqueue_adapter_cuda.match index f6f0d3e591..2392247314 100644 --- a/test/conformance/enqueue/enqueue_adapter_cuda.match +++ b/test/conformance/enqueue/enqueue_adapter_cuda.match @@ -56,3 +56,4 @@ {{OPT}}urEnqueueUSMMemcpy2DNegativeTest.InvalidEventWaitList/NVIDIA_CUDA_BACKEND___{{.*}}___pitch__1__width__1__height__1 {{OPT}}urEnqueueUSMPrefetchWithParamTest.Success/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_MIGRATION_FLAG_DEFAULT {{OPT}}urEnqueueUSMPrefetchWithParamTest.CheckWaitEvent/NVIDIA_CUDA_BACKEND___{{.*}}___UR_USM_MIGRATION_FLAG_DEFAULT +{{OPT}}{{Segmentation fault|Aborted}} diff --git a/test/conformance/enqueue/enqueue_adapter_hip.match b/test/conformance/enqueue/enqueue_adapter_hip.match index 9d48681c1a..fe890b62b5 100644 --- a/test/conformance/enqueue/enqueue_adapter_hip.match +++ b/test/conformance/enqueue/enqueue_adapter_hip.match @@ -1,4 +1,4 @@ -{{OPT}}Segmentation Fault +{{OPT}}{{Segmentation fault|Aborted}} {{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.Success/AMD_HIP_BACKEND___{{.*}}_ {{OPT}}urEnqueueDeviceGetGlobalVariableReadTest.InvalidEventWaitInvalidEvent/AMD_HIP_BACKEND___{{.*}}_ {{OPT}}urEnqueueDeviceGetGlobalVariableWriteTest.InvalidEventWaitInvalidEvent/AMD_HIP_BACKEND___{{.*}}_ diff --git a/test/conformance/enqueue/enqueue_adapter_opencl.match b/test/conformance/enqueue/enqueue_adapter_opencl.match index 54a5ee3762..a034083c87 100644 --- a/test/conformance/enqueue/enqueue_adapter_opencl.match +++ b/test/conformance/enqueue/enqueue_adapter_opencl.match @@ -1,35 +1,35 @@ -{{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}}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___{{.*}}_ +{{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}}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/enqueue/urEnqueueUSMAdvise.cpp b/test/conformance/enqueue/urEnqueueUSMAdvise.cpp index 1a9fe6b339..10a1e03670 100644 --- a/test/conformance/enqueue/urEnqueueUSMAdvise.cpp +++ b/test/conformance/enqueue/urEnqueueUSMAdvise.cpp @@ -68,3 +68,11 @@ TEST_P(urEnqueueUSMAdviseTest, InvalidSizeTooLarge) { urEnqueueUSMAdvise(queue, ptr, allocation_size * 2, UR_USM_ADVICE_FLAG_DEFAULT, nullptr)); } + +TEST_P(urEnqueueUSMAdviseTest, NonCoherentDeviceMemorySuccessOrWarning) { + ur_result_t result = + urEnqueueUSMAdvise(queue, ptr, allocation_size, + UR_USM_ADVICE_FLAG_SET_NON_COHERENT_MEMORY, nullptr); + ASSERT_EQ(result, + result & (UR_RESULT_SUCCESS | UR_RESULT_ERROR_ADAPTER_SPECIFIC)); +} diff --git a/test/conformance/event/event_adapter_level_zero.match b/test/conformance/event/event_adapter_level_zero.match index a316044ab1..c29f67cbc6 100644 --- a/test/conformance/event/event_adapter_level_zero.match +++ b/test/conformance/event/event_adapter_level_zero.match @@ -1,4 +1,4 @@ {{OPT}}urEventGetInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_EVENT_INFO_COMMAND_TYPE {{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_QUEUED {{OPT}}urEventGetProfilingInfoTest.Success/Intel_R__oneAPI_Unified_Runtime_over_Level_Zero___{{.*}}___UR_PROFILING_INFO_COMMAND_SUBMIT -{{OPT}} Segmentation fault +{{OPT}}{{Segmentation fault|Aborted}} diff --git a/test/conformance/kernel/kernel_adapter_hip.match b/test/conformance/kernel/kernel_adapter_hip.match index 96d579f088..97864c4e70 100644 --- a/test/conformance/kernel/kernel_adapter_hip.match +++ b/test/conformance/kernel/kernel_adapter_hip.match @@ -1,4 +1,4 @@ -{{OPT}}Segmentation Fault +{{OPT}}{{Segmentation fault|Aborted}} {{OPT}}urKernelGetInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_KERNEL_INFO_NUM_REGS {{OPT}}urKernelGetInfoTest.InvalidSizeSmall/AMD_HIP_BACKEND___{{.*}}___UR_KERNEL_INFO_FUNCTION_NAME {{OPT}}urKernelGetInfoTest.InvalidSizeSmall/AMD_HIP_BACKEND___{{.*}}___UR_KERNEL_INFO_NUM_ARGS diff --git a/test/conformance/kernel/kernel_adapter_opencl.match b/test/conformance/kernel/kernel_adapter_opencl.match index 799225be19..9a71945c45 100644 --- a/test/conformance/kernel/kernel_adapter_opencl.match +++ b/test/conformance/kernel/kernel_adapter_opencl.match @@ -1,5 +1,5 @@ -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___{{.*}}_ +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 c01e55d804..23dfbbae8c 100644 --- a/test/conformance/memory/memory_adapter_opencl.match +++ b/test/conformance/memory/memory_adapter_opencl.match @@ -1 +1 @@ -urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}}_ +urMemImageCreateTest.InvalidImageDescStype/Intel_R__OpenCL___{{.*}} diff --git a/test/conformance/program/program_adapter_hip.match b/test/conformance/program/program_adapter_hip.match index 67f98ec2f7..1f95931e09 100644 --- a/test/conformance/program/program_adapter_hip.match +++ b/test/conformance/program/program_adapter_hip.match @@ -1,4 +1,4 @@ -{{OPT}}Segmentation Fault +{{OPT}}{{Segmentation fault|Aborted}} {{OPT}}urProgramCreateWithNativeHandleTest.InvalidNullHandleContext/AMD_HIP_BACKEND___{{.*}}_ {{OPT}}urProgramCreateWithNativeHandleTest.InvalidNullPointerProgram/AMD_HIP_BACKEND___{{.*}}_ {{OPT}}urProgramGetBuildInfoTest.Success/AMD_HIP_BACKEND___{{.*}}___UR_PROGRAM_BUILD_INFO_BINARY_TYPE diff --git a/test/conformance/usm/usm_adapter_opencl.match b/test/conformance/usm/usm_adapter_opencl.match index 16211ba8e7..3e729141b9 100644 --- a/test/conformance/usm/usm_adapter_opencl.match +++ b/test/conformance/usm/usm_adapter_opencl.match @@ -12,24 +12,24 @@ urUSMHostAllocTest.InvalidNullHandleContext/Intel_R__OpenCL___{{.*}}___UsePoolEn 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___{{.*}}_ +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___{{.*}}_ +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 diff --git a/test/layers/validation/CMakeLists.txt b/test/layers/validation/CMakeLists.txt index 85d639d196..944202e0d2 100644 --- a/test/layers/validation/CMakeLists.txt +++ b/test/layers/validation/CMakeLists.txt @@ -4,20 +4,20 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception set(UR_VALIDATION_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(VAL_TEST_PREFIX validation_test) -function(add_validation_test name) - set(TEST_TARGET_NAME validation_test-${name}) - add_ur_executable(${TEST_TARGET_NAME} +function(add_validation_test_executable name) + add_ur_executable(${VAL_TEST_PREFIX}-${name} ${ARGN}) - target_link_libraries(${TEST_TARGET_NAME} + target_link_libraries(${VAL_TEST_PREFIX}-${name} PRIVATE ${PROJECT_NAME}::loader ${PROJECT_NAME}::headers ${PROJECT_NAME}::testing GTest::gtest_main) - add_test(NAME ${name} - COMMAND ${TEST_TARGET_NAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +endfunction() + +function(set_validation_test_properties name) set_tests_properties(${name} PROPERTIES LABELS "validation") set_property(TEST ${name} PROPERTY ENVIRONMENT "UR_ENABLE_LAYERS=UR_LAYER_FULL_VALIDATION" @@ -25,11 +25,28 @@ function(add_validation_test name) "UR_LOG_VALIDATION=level:debug\;flush:debug\;output:stdout") endfunction() -function(add_validation_match_test name match_file) - add_validation_test(${name} ${ARGN}) - file(READ ${match_file} MATCH_STRING) - set_tests_properties(${name} PROPERTIES - PASS_REGULAR_EXPRESSION "${MATCH_STRING}") +function(add_validation_test name) + add_validation_test_executable(${name} ${ARGN}) + + add_test(NAME ${name} + COMMAND ${VAL_TEST_PREFIX}-${name} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + set_validation_test_properties(${name}) +endfunction() + +function(add_validation_match_test name) + add_validation_test_executable(${name} ${ARGN}) + + add_test(NAME ${name} + COMMAND ${CMAKE_COMMAND} + -D MODE=stdout + -D TEST_FILE=$ + -D MATCH_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${name}.out.match + -P ${PROJECT_SOURCE_DIR}/cmake/match.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + set_validation_test_properties(${name}) endfunction() add_validation_test(parameters parameters.cpp) diff --git a/test/layers/validation/leaks.cpp b/test/layers/validation/leaks.cpp index e32aeafc89..794e8a3ef0 100644 --- a/test/layers/validation/leaks.cpp +++ b/test/layers/validation/leaks.cpp @@ -11,6 +11,19 @@ TEST_F(urTest, testUrAdapterGetLeak) { ASSERT_NE(nullptr, adapter); } +TEST_F(urTest, testUrAdapterRetainLeak) { + ur_adapter_handle_t adapter = nullptr; + ASSERT_EQ(urAdapterGet(1, &adapter, nullptr), UR_RESULT_SUCCESS); + ASSERT_NE(nullptr, adapter); + ASSERT_EQ(urAdapterRetain(adapter), UR_RESULT_SUCCESS); +} + +TEST_F(urTest, testUrAdapterRetainNonexistent) { + ur_adapter_handle_t adapter = (ur_adapter_handle_t)0xBEEF; + ASSERT_EQ(urAdapterRetain(adapter), 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 9fac722527..2a36a22263 100644 --- a/test/layers/validation/leaks.out.match +++ b/test/layers/validation/leaks.out.match @@ -1,47 +1,67 @@ -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 1 -\[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\]: 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: -(.*) +{{IGNORE}} +[ RUN ] urTest.testUrAdapterGetLeak +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1 +[ERROR]: Retained 1 reference(s) to handle {{[0-9xa-fA-F]+}} +[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here: +{{IGNORE}} +[ RUN ] urTest.testUrAdapterRetainLeak +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1 +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 2 +[ERROR]: Retained 2 reference(s) to handle {{[0-9xa-fA-F]+}} +[ERROR]: Handle {{[0-9xa-fA-F]+}} was recorded for first time here: +{{IGNORE}} +[ RUN ] urTest.testUrAdapterRetainNonexistent +[ERROR]: Attempting to retain nonexistent handle {{[0-9xa-fA-F]+}} +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextCreateLeak +[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: +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextRetainLeak +[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: +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextRetainNonexistent +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 1 +[ERROR]: Attempting to retain nonexistent handle {{[0-9xa-fA-F]+}} +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 0 +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextCreateSuccess +[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 +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextRetainSuccess +[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 +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextReleaseLeak +[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: +{{IGNORE}} +[ RUN ] valDeviceTest.testUrContextReleaseNonexistent +[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: +{{IGNORE}} diff --git a/test/layers/validation/leaks_mt.out.match b/test/layers/validation/leaks_mt.out.match index 86de1e1d76..f1bd32f8b5 100644 --- a/test/layers/validation/leaks_mt.out.match +++ b/test/layers/validation/leaks_mt.out.match @@ -1,84 +1,91 @@ -\[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 -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 5 -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to 6 -\[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 -\[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -2 -\[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -3 -\[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -4 -\[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ -\[DEBUG\]: Reference count for handle [0-9xa-fA-F]+ changed to -5 -\[ERROR\]: Attempting to release nonexistent handle [0-9xa-fA-F]+ -\[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]+ -\[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-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-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-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: -(.*) +{{IGNORE}} +[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainLeakMt/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 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: +{{IGNORE}} +[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainLeakMt/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 +[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 +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 5 +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to 6 +[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: +{{IGNORE}} +[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextReleaseLeakMt/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: +{{IGNORE}} +[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextReleaseLeakMt/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 +[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 +[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}} +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -2 +[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}} +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -3 +[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}} +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -4 +[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}} +[DEBUG]: Reference count for handle {{[0-9xa-fA-F]+}} changed to -5 +[ERROR]: Attempting to release nonexistent handle {{[0-9xa-fA-F]+}} +[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: +{{IGNORE}} +[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainReleaseLeakMt/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 {{[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: +{{IGNORE}} +[ RUN ] threadCountForValDeviceTest/valDeviceTestMultithreaded.testUrContextRetainReleaseLeakMt/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 +[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-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-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-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-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: +{{IGNORE}}