Skip to content

test: add unit tests for common utilities from PR #1249 - #2237

Merged
habajpai-amd merged 7 commits into
developfrom
users/habajpai-amd/common-utilities-unit-tests
Dec 18, 2025
Merged

test: add unit tests for common utilities from PR #1249#2237
habajpai-amd merged 7 commits into
developfrom
users/habajpai-amd/common-utilities-unit-tests

Conversation

@habajpai-amd

@habajpai-amd habajpai-amd commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

Motivation

Add unit tests for common utilities centralized in PR #1249 (path utilities, remove_env, discover_llvm_libdir_for_ompt), similar to what was done for update_env in PR #2029.

Technical Details

  • Created test_remove_env.cpp with 19 test cases for remove_env function
  • Created test_path.cpp with 49 test cases for path utilities (get_rocprofsys_root, get_internal_libpath, get_internal_script_path, get_internal_libdir, dirname, exists, etc.)
  • Created test_discover_llvm_libdir.cpp with 18 test cases for discover_llvm_libdir_for_ompt
  • Fixed bug in remove_env: null entries were not being removed from vector after freeing
  • Updated test fixtures to follow m_ prefix convention per rules shared by Alex

JIRA ID

Test Plan

  • Run unit tests: ctest -R "rocprof-sys-unit-tests" -V
  • Verified all test suites pass individually

Test Result

219/219 unit tests pass in NAVI22, MI308, MI325, MI350, MI355, MI300A, MI250X, MI210X, MI50/MI60, MI300X
ctest -R "rocprof-sys-unit-tests" -V
UpdateCTestConfiguration from :rocm-systems/projects/rocprofiler-systems/build/debug-optimized/DartConfiguration.tcl
Parse Config file:rocm-systems/projects/rocprofiler-systems/build/debug-optimized/DartConfiguration.tcl
UpdateCTestConfiguration from : rocm-systems/projects/rocprofiler-systems/build/debug-optimized/DartConfiguration.tcl
Parse Config file:rocm-systems/projects/rocprofiler-systems/build/debug-optimized/DartConfiguration.tcl
Test project rocm-systems/projects/rocprofiler-systems/build/debug-optimized
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: rocprof-sys-unit-tests

1: Test command: rocm-systems/projects/rocprofiler-systems/build/debug-optimized/bin/rocprof-sys-unit-tests
1: Test timeout computed to be: 1500
1: Running main() from
rocm-systems/projects/rocprofiler-systems/external/googletest/googletest/src/gtest_main.cc
1: [==========] Running 219 tests from 12 test suites.
1: [----------] Global test environment set-up.
1: [----------] 18 tests from DiscoverLlvmLibdirTest
1: [ RUN ] DiscoverLlvmLibdirTest.FindsLibInRocmPathLlvmLib
1: [ OK ] DiscoverLlvmLibdirTest.FindsLibInRocmPathLlvmLib (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.FindsLibInRocmPathLibLlvmLib
1: [ OK ] DiscoverLlvmLibdirTest.FindsLibInRocmPathLibLlvmLib (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.PrefersLlvmLibOverLibLlvmLib
1: [ OK ] DiscoverLlvmLibdirTest.PrefersLlvmLibOverLibLlvmLib (2 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.RocmVersionDirLlvmLib
1: [ OK ] DiscoverLlvmLibdirTest.RocmVersionDirLlvmLib (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.RocmVersionDirLib
1: [ OK ] DiscoverLlvmLibdirTest.RocmVersionDirLib (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.RocmVersionDirTakesPrecedence
1: [ OK ] DiscoverLlvmLibdirTest.RocmVersionDirTakesPrecedence (2 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.NoLibomptargetFound_InCustomPath
1: [ OK ] DiscoverLlvmLibdirTest.NoLibomptargetFound_InCustomPath (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.TrailingSlashInRocmPath
1: [ OK ] DiscoverLlvmLibdirTest.TrailingSlashInRocmPath (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.TrailingSlashInRocmVersionDir
1: [ OK ] DiscoverLlvmLibdirTest.TrailingSlashInRocmVersionDir (2 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.EmptyRocmVersionDir
1: [ OK ] DiscoverLlvmLibdirTest.EmptyRocmVersionDir (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.VerboseModeDoesNotCrash
1: [rocprof-sys][1454975] Using LLVM libdir: /tmp/rocprofsys_llvm_test_Dt7VYT/rocm/llvm/lib
1: [ OK ] DiscoverLlvmLibdirTest.VerboseModeDoesNotCrash (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.VerboseModeNoLibFound
1: [rocprof-sys][1454975] Using LLVM libdir: /opt/rocm/llvm/lib
1: [ OK ] DiscoverLlvmLibdirTest.VerboseModeNoLibFound (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.RocmVersionDirLlvmLibPreferredOverLib
1: [ OK ] DiscoverLlvmLibdirTest.RocmVersionDirLlvmLibPreferredOverLib (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.FallsBackToRocmPathWhenRocmVersionDirHasNoLib
1: [ OK ] DiscoverLlvmLibdirTest.FallsBackToRocmPathWhenRocmVersionDirHasNoLib (2 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.MultipleTrailingSlashes
1: [ OK ] DiscoverLlvmLibdirTest.MultipleTrailingSlashes (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.PathWithSpaces
1: [ OK ] DiscoverLlvmLibdirTest.PathWithSpaces (1 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.BothEnvVarsUnset_UsesDefaultRocmPath
1: [ OK ] DiscoverLlvmLibdirTest.BothEnvVarsUnset_UsesDefaultRocmPath (0 ms)
1: [ RUN ] DiscoverLlvmLibdirTest.SymlinkToLibomptarget
1: [ OK ] DiscoverLlvmLibdirTest.SymlinkToLibomptarget (1 ms)
1: [----------] 18 tests from DiscoverLlvmLibdirTest (30 ms total)
1:
1: [----------] 49 tests from PathTest
1: [ RUN ] PathTest.Dirname_StandardPath
1: [ OK ] PathTest.Dirname_StandardPath (0 ms)
1: [ RUN ] PathTest.Dirname_SingleLevel
1: [ OK ] PathTest.Dirname_SingleLevel (0 ms)
1: [ RUN ] PathTest.Dirname_RootFile
1: [ OK ] PathTest.Dirname_RootFile (0 ms)
1: [ RUN ] PathTest.Dirname_NoSlash
1: [ OK ] PathTest.Dirname_NoSlash (0 ms)
1: [ RUN ] PathTest.Dirname_EmptyString
1: [ OK ] PathTest.Dirname_EmptyString (0 ms)
1: [ RUN ] PathTest.Dirname_TrailingSlash
1: [ OK ] PathTest.Dirname_TrailingSlash (0 ms)
1: [ RUN ] PathTest.Dirname_MultipleSlashes
1: [ OK ] PathTest.Dirname_MultipleSlashes (0 ms)
1: [ RUN ] PathTest.Exists_ExistingFile
1: [ OK ] PathTest.Exists_ExistingFile (0 ms)
1: [ RUN ] PathTest.Exists_NonexistentFile
1: [ OK ] PathTest.Exists_NonexistentFile (0 ms)
1: [ RUN ] PathTest.Exists_ExistingDirectory
1: [ OK ] PathTest.Exists_ExistingDirectory (0 ms)
1: [ RUN ] PathTest.Exists_NonexistentDirectory
1: [ OK ] PathTest.Exists_NonexistentDirectory (0 ms)
1: [ RUN ] PathTest.Exists_SymbolicLink
1: [ OK ] PathTest.Exists_SymbolicLink (0 ms)
1: [ RUN ] PathTest.Exists_BrokenSymlink
1: [ OK ] PathTest.Exists_BrokenSymlink (0 ms)
1: [ RUN ] PathTest.Exists_EmptyPath
1: [ OK ] PathTest.Exists_EmptyPath (0 ms)
1: [ RUN ] PathTest.IsLink_RegularFile
1: [ OK ] PathTest.IsLink_RegularFile (0 ms)
1: [ RUN ] PathTest.IsLink_Directory
1: [ OK ] PathTest.IsLink_Directory (0 ms)
1: [ RUN ] PathTest.IsLink_SymbolicLink
1: [ OK ] PathTest.IsLink_SymbolicLink (0 ms)
1: [ RUN ] PathTest.IsLink_NonexistentPath
1: [ OK ] PathTest.IsLink_NonexistentPath (0 ms)
1: [ RUN ] PathTest.Readlink_SymbolicLink
1: [ OK ] PathTest.Readlink_SymbolicLink (0 ms)
1: [ RUN ] PathTest.Readlink_NotALink
1: [ OK ] PathTest.Readlink_NotALink (0 ms)
1: [ RUN ] PathTest.Readlink_NonexistentPath
1: [ OK ] PathTest.Readlink_NonexistentPath (0 ms)
1: [ RUN ] PathTest.Realpath_RelativePath
1: [ OK ] PathTest.Realpath_RelativePath (0 ms)
1: [ RUN ] PathTest.Realpath_AbsolutePath
1: [ OK ] PathTest.Realpath_AbsolutePath (0 ms)
1: [ RUN ] PathTest.Realpath_WithSymlink
1: [ OK ] PathTest.Realpath_WithSymlink (0 ms)
1: [ RUN ] PathTest.Realpath_NonexistentPath
1: [ OK ] PathTest.Realpath_NonexistentPath (0 ms)
1: [ RUN ] PathTest.Realpath_WithResolvedOutput
1: [ OK ] PathTest.Realpath_WithResolvedOutput (0 ms)
1: [ RUN ] PathTest.IsTextFile_TextFile
1: [ OK ] PathTest.IsTextFile_TextFile (0 ms)
1: [ RUN ] PathTest.IsTextFile_BinaryFile
1: [ OK ] PathTest.IsTextFile_BinaryFile (0 ms)
1: [ RUN ] PathTest.IsTextFile_EmptyFile
1: [ OK ] PathTest.IsTextFile_EmptyFile (0 ms)
1: [ RUN ] PathTest.PathType_Directory
1: [ OK ] PathTest.PathType_Directory (0 ms)
1: [ RUN ] PathTest.PathType_RegularFile
1: [ OK ] PathTest.PathType_RegularFile (0 ms)
1: [ RUN ] PathTest.PathType_SymbolicLink
1: [ OK ] PathTest.PathType_SymbolicLink (0 ms)
1: [ RUN ] PathTest.PathType_Nonexistent
1: [ OK ] PathTest.PathType_Nonexistent (0 ms)
1: [ RUN ] PathTest.GetRocprofsysRoot_ReturnsNonEmpty
1: [ OK ] PathTest.GetRocprofsysRoot_ReturnsNonEmpty (0 ms)
1: [ RUN ] PathTest.GetRocprofsysRoot_EndsWithParentDir
1: [ OK ] PathTest.GetRocprofsysRoot_EndsWithParentDir (0 ms)
1: [ RUN ] PathTest.GetInternalLibdir_ContainsLib
1: [ OK ] PathTest.GetInternalLibdir_ContainsLib (0 ms)
1: [ RUN ] PathTest.GetInternalScriptPath_ContainsLibexec
1: [ OK ] PathTest.GetInternalScriptPath_ContainsLibexec (0 ms)
1: [ RUN ] PathTest.GetInternalLibpath_ContainsLibName
1: [ OK ] PathTest.GetInternalLibpath_ContainsLibName (0 ms)
1: [ RUN ] PathTest.GetInternalLibpath_ContainsLib
1: [ OK ] PathTest.GetInternalLibpath_ContainsLib (0 ms)
1: [ RUN ] PathTest.GetDefaultLibSearchPaths_ReturnsNonEmpty
1: [ OK ] PathTest.GetDefaultLibSearchPaths_ReturnsNonEmpty (0 ms)
1: [ RUN ] PathTest.GetDefaultLibSearchPaths_AsVector
1: [ OK ] PathTest.GetDefaultLibSearchPaths_AsVector (0 ms)
1: [ RUN ] PathTest.FindPath_AbsoluteExisting
1: [ OK ] PathTest.FindPath_AbsoluteExisting (0 ms)
1: [ RUN ] PathTest.FindPath_NonexistentReturnsOriginal
1: [ OK ] PathTest.FindPath_NonexistentReturnsOriginal (0 ms)
1: [ RUN ] PathTest.FindPath_InSearchPath
1: [ OK ] PathTest.FindPath_InSearchPath (0 ms)
1: [ RUN ] PathTest.Dirname_ComplexPath
1: [ OK ] PathTest.Dirname_ComplexPath (0 ms)
1: [ RUN ] PathTest.ChainedSymlinks
1: [ OK ] PathTest.ChainedSymlinks (0 ms)
1: [ RUN ] PathTest.Exists_SpecialCharactersInPath
1: [ OK ] PathTest.Exists_SpecialCharactersInPath (0 ms)
1: [ RUN ] PathTest.Dirname_RocprofsysTypicalPath
1: [ OK ] PathTest.Dirname_RocprofsysTypicalPath (0 ms)
1: [ RUN ] PathTest.NestedDirectories
1: [ OK ] PathTest.NestedDirectories (0 ms)
1: [----------] 49 tests from PathTest (29 ms total)
1:
1: [----------] 19 tests from RemoveEnvTest
1: [ RUN ] RemoveEnvTest.RemoveSingleVariable
1: [ OK ] RemoveEnvTest.RemoveSingleVariable (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveFirstVariable
1: [ OK ] RemoveEnvTest.RemoveFirstVariable (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveLastVariable
1: [ OK ] RemoveEnvTest.RemoveLastVariable (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveNonexistentVariable
1: [ OK ] RemoveEnvTest.RemoveNonexistentVariable (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveFromEmptyVector
1: [ OK ] RemoveEnvTest.RemoveFromEmptyVector (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveOnlyVariable
1: [ OK ] RemoveEnvTest.RemoveOnlyVariable (0 ms)
1: [ RUN ] RemoveEnvTest.RestoreFromOriginalEnvs
1: [ OK ] RemoveEnvTest.RestoreFromOriginalEnvs (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveVariableNotInOriginal_NoRestore
1: [ OK ] RemoveEnvTest.RemoveVariableNotInOriginal_NoRestore (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveWithSimilarPrefixes
1: [ OK ] RemoveEnvTest.RemoveWithSimilarPrefixes (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveWithNullEntries
1: [ OK ] RemoveEnvTest.RemoveWithNullEntries (0 ms)
1: [ RUN ] RemoveEnvTest.RemoveMultipleTimes
1: [ OK ] RemoveEnvTest.RemoveMultipleTimes (0 ms)
1: [ RUN ] RemoveEnvTest.RealWorld_LD_PRELOAD
1: [ OK ] RemoveEnvTest.RealWorld_LD_PRELOAD (0 ms)
1: [ RUN ] RemoveEnvTest.RealWorld_RestoreROCPROFSYS_Variable
1: [ OK ] RemoveEnvTest.RealWorld_RestoreROCPROFSYS_Variable (0 ms)
1: [ RUN ] RemoveEnvTest.EmptyVariableName
1: [ OK ] RemoveEnvTest.EmptyVariableName (0 ms)
1: [ RUN ] RemoveEnvTest.VariableWithEmptyValue
1: [ OK ] RemoveEnvTest.VariableWithEmptyValue (0 ms)
1: [ RUN ] RemoveEnvTest.VariableWithSpecialCharactersInValue
1: [ OK ] RemoveEnvTest.VariableWithSpecialCharactersInValue (0 ms)
1: [ RUN ] RemoveEnvTest.LongVariableName
1: [ OK ] RemoveEnvTest.LongVariableName (0 ms)
1: [ RUN ] RemoveEnvTest.RestoreMultipleOriginalValues
1: [ OK ] RemoveEnvTest.RestoreMultipleOriginalValues (0 ms)
1: [ RUN ] RemoveEnvTest.CaseSensitiveRemoval
1: [ OK ] RemoveEnvTest.CaseSensitiveRemoval (0 ms)
1: [----------] 19 tests from RemoveEnvTest (0 ms total)
1:
1: [----------] 29 tests from UpdateEnvTest
1: [ RUN ] UpdateEnvTest.ReplaceMode_NewVariable
1: [ OK ] UpdateEnvTest.ReplaceMode_NewVariable (0 ms)
1: [ RUN ] UpdateEnvTest.ReplaceMode_ExistingVariable
1: [ OK ] UpdateEnvTest.ReplaceMode_ExistingVariable (0 ms)
1: [ RUN ] UpdateEnvTest.AppendMode_NewVariable
1: [ OK ] UpdateEnvTest.AppendMode_NewVariable (0 ms)
1: [ RUN ] UpdateEnvTest.AppendMode_ExistingVariable
1: [ OK ] UpdateEnvTest.AppendMode_ExistingVariable (0 ms)
1: [ RUN ] UpdateEnvTest.PrependMode_ExistingVariable
1: [ OK ] UpdateEnvTest.PrependMode_ExistingVariable (0 ms)
1: [ RUN ] UpdateEnvTest.WeakMode_OriginalValue
1: [ OK ] UpdateEnvTest.WeakMode_OriginalValue (0 ms)
1: [ RUN ] UpdateEnvTest.WeakMode_ModifiedValue
1: [ OK ] UpdateEnvTest.WeakMode_ModifiedValue (0 ms)
1: [ RUN ] UpdateEnvTest.BooleanValue_True
1: [ OK ] UpdateEnvTest.BooleanValue_True (0 ms)
1: [ RUN ] UpdateEnvTest.BooleanValue_False
1: [ OK ] UpdateEnvTest.BooleanValue_False (0 ms)
1: [ RUN ] UpdateEnvTest.NumericValue
1: [ OK ] UpdateEnvTest.NumericValue (0 ms)
1: [ RUN ] UpdateEnvTest.AppendMode_AvoidsDuplicates
1: [ OK ] UpdateEnvTest.AppendMode_AvoidsDuplicates (0 ms)
1: [ RUN ] UpdateEnvTest.CustomDelimiter
1: [ OK ] UpdateEnvTest.CustomDelimiter (0 ms)
1: [ RUN ] UpdateEnvTest.RealWorld_LD_LIBRARY_PATH_Append
1: [ OK ] UpdateEnvTest.RealWorld_LD_LIBRARY_PATH_Append (0 ms)
1: [ RUN ] UpdateEnvTest.RealWorld_LD_PRELOAD_Prepend
1: [ OK ] UpdateEnvTest.RealWorld_LD_PRELOAD_Prepend (0 ms)
1: [ RUN ] UpdateEnvTest.RealWorld_ROCPROFSYS_Environment_Variables
1: [ OK ] UpdateEnvTest.RealWorld_ROCPROFSYS_Environment_Variables (0 ms)
1: [ RUN ] UpdateEnvTest.RealWorld_Timing_DoubleValues
1: [ OK ] UpdateEnvTest.RealWorld_Timing_DoubleValues (0 ms)
1: [ RUN ] UpdateEnvTest.StringTypes_StdString
1: [ OK ] UpdateEnvTest.StringTypes_StdString (0 ms)
1: [ RUN ] UpdateEnvTest.StringTypes_ConstCharPtr
1: [ OK ] UpdateEnvTest.StringTypes_ConstCharPtr (0 ms)
1: [ RUN ] UpdateEnvTest.EmptyStringValue
1: [ OK ] UpdateEnvTest.EmptyStringValue (0 ms)
1: [ RUN ] UpdateEnvTest.MultipleVariables_DifferentNames
1: [ OK ] UpdateEnvTest.MultipleVariables_DifferentNames (0 ms)
1: [ RUN ] UpdateEnvTest.NullPointer_InEnvironmentVector
1: [ OK ] UpdateEnvTest.NullPointer_InEnvironmentVector (0 ms)
1: [ RUN ] UpdateEnvTest.LongPath_Append
1: [ OK ] UpdateEnvTest.LongPath_Append (0 ms)
1: [ RUN ] UpdateEnvTest.SpecialCharacters_InValue
1: [ OK ] UpdateEnvTest.SpecialCharacters_InValue (0 ms)
1: [ RUN ] UpdateEnvTest.IntegerValues_Positive
1: [ OK ] UpdateEnvTest.IntegerValues_Positive (0 ms)
1: [ RUN ] UpdateEnvTest.IntegerValues_Negative
1: [ OK ] UpdateEnvTest.IntegerValues_Negative (0 ms)
1: [ RUN ] UpdateEnvTest.IntegerValues_Zero
1: [ OK ] UpdateEnvTest.IntegerValues_Zero (0 ms)
1: [ RUN ] UpdateEnvTest.UpdateTracking_MultipleUpdates
1: [ OK ] UpdateEnvTest.UpdateTracking_MultipleUpdates (0 ms)
1: [ RUN ] UpdateEnvTest.WeakMode_SequentialUpdates
1: [ OK ] UpdateEnvTest.WeakMode_SequentialUpdates (0 ms)
1: [ RUN ] UpdateEnvTest.Append_MultiplePathsInSequence
1: [ OK ] UpdateEnvTest.Append_MultiplePathsInSequence (0 ms)
1: [----------] 29 tests from UpdateEnvTest (0 ms total)
1:
1: [----------] 5 tests from type_registry_test
1: [ RUN ] type_registry_test.test_get_type_sample_1
1: [ OK ] type_registry_test.test_get_type_sample_1 (0 ms)
1: [ RUN ] type_registry_test.test_get_type_sample_2
1: [ OK ] type_registry_test.test_get_type_sample_2 (0 ms)
1: [ RUN ] type_registry_test.test_get_type_unknown_id
1: [ OK ] type_registry_test.test_get_type_unknown_id (0 ms)
1: [ RUN ] type_registry_test.test_variant_type_definition
1: [ OK ] type_registry_test.test_variant_type_definition (0 ms)
1: [ RUN ] type_registry_test.test_multiple_calls_same_type
1: [ OK ] type_registry_test.test_multiple_calls_same_type (0 ms)
1: [----------] 5 tests from type_registry_test (0 ms total)
1:
1: [----------] 22 tests from cacheable_test
1: [ RUN ] cacheable_test.store_value_int
1: [ OK ] cacheable_test.store_value_int (0 ms)
1: [ RUN ] cacheable_test.store_value_double
1: [ OK ] cacheable_test.store_value_double (0 ms)
1: [ RUN ] cacheable_test.store_value_unsigned_long
1: [ OK ] cacheable_test.store_value_unsigned_long (0 ms)
1: [ RUN ] cacheable_test.store_value_unsigned_char
1: [ OK ] cacheable_test.store_value_unsigned_char (0 ms)
1: [ RUN ] cacheable_test.store_value_string_literal
1: [ OK ] cacheable_test.store_value_string_literal (0 ms)
1: [ RUN ] cacheable_test.store_value_empty_string
1: [ OK ] cacheable_test.store_value_empty_string (0 ms)
1: [ RUN ] cacheable_test.store_value_byte_array
1: [ OK ] cacheable_test.store_value_byte_array (0 ms)
1: [ RUN ] cacheable_test.store_value_empty_byte_array
1: [ OK ] cacheable_test.store_value_empty_byte_array (0 ms)
1: [ RUN ] cacheable_test.store_multiple_values
1: [ OK ] cacheable_test.store_multiple_values (0 ms)
1: [ RUN ] cacheable_test.parse_value_int
1: [ OK ] cacheable_test.parse_value_int (0 ms)
1: [ RUN ] cacheable_test.parse_value_double
1: [ OK ] cacheable_test.parse_value_double (0 ms)
1: [ RUN ] cacheable_test.parse_value_unsigned_long
1: [ OK ] cacheable_test.parse_value_unsigned_long (0 ms)
1: [ RUN ] cacheable_test.parse_value_string
1: [ OK ] cacheable_test.parse_value_string (0 ms)
1: [ RUN ] cacheable_test.parse_value_empty_string
1: [ OK ] cacheable_test.parse_value_empty_string (0 ms)
1: [ RUN ] cacheable_test.parse_value_byte_array
1: [ OK ] cacheable_test.parse_value_byte_array (0 ms)
1: [ RUN ] cacheable_test.parse_value_empty_byte_array
1: [ OK ] cacheable_test.parse_value_empty_byte_array (0 ms)
1: [ RUN ] cacheable_test.parse_multiple_values
1: [ OK ] cacheable_test.parse_multiple_values (0 ms)
1: [ RUN ] cacheable_test.get_size_helper_int
1: [ OK ] cacheable_test.get_size_helper_int (0 ms)
1: [ RUN ] cacheable_test.get_size_helper_double
1: [ OK ] cacheable_test.get_size_helper_double (0 ms)
1: [ RUN ] cacheable_test.get_size_helper_string_literal
1: [ OK ] cacheable_test.get_size_helper_string_literal (0 ms)
1: [ RUN ] cacheable_test.get_size_helper_byte_array
1: [ OK ] cacheable_test.get_size_helper_byte_array (0 ms)
1: [ RUN ] cacheable_test.get_buffered_storage_filename
1: [ OK ] cacheable_test.get_buffered_storage_filename (0 ms)
1: [----------] 22 tests from cacheable_test (0 ms total)
1:
1: [----------] 11 tests from buffer_storage_test
1: [ RUN ] buffer_storage_test.multiple_start
1: [ OK ] buffer_storage_test.multiple_start (24 ms)
1: [ RUN ] buffer_storage_test.start_stop
1: [ OK ] buffer_storage_test.start_stop (22 ms)
1: [ RUN ] buffer_storage_test.try_store_event_sample_throw
1: [ OK ] buffer_storage_test.try_store_event_sample_throw (32 ms)
1: [ RUN ] buffer_storage_test.store_after_shutdown
1: [ OK ] buffer_storage_test.store_after_shutdown (21 ms)
1: [ RUN ] buffer_storage_test.store_event_samples
1: [ OK ] buffer_storage_test.store_event_samples (35 ms)
1: [ RUN ] buffer_storage_test.immediately_flush
1: [ OK ] buffer_storage_test.immediately_flush (23 ms)
1: [ RUN ] buffer_storage_test.flush_below_threshold
1: [ OK ] buffer_storage_test.flush_below_threshold (24 ms)
1: [ RUN ] buffer_storage_test.MixedSampleTypes
1: [ OK ] buffer_storage_test.MixedSampleTypes (23 ms)
1: [ RUN ] buffer_storage_test.large_payload_handling
1: [ OK ] buffer_storage_test.large_payload_handling (21 ms)
1: [ RUN ] buffer_storage_test.concurrent_mixed_type_store
1: [ OK ] buffer_storage_test.concurrent_mixed_type_store (20 ms)
1: [ RUN ] buffer_storage_test.repeated_fragmentation
1: [ OK ] buffer_storage_test.repeated_fragmentation (165 ms)
1: [----------] 11 tests from buffer_storage_test (414 ms total)
1:
1: [----------] 10 tests from storage_parser_test
1: [ RUN ] storage_parser_test.load_empty_file
1: [ OK ] storage_parser_test.load_empty_file (0 ms)
1: [ RUN ] storage_parser_test.load_single_sample_type_1
1: [ OK ] storage_parser_test.load_single_sample_type_1 (0 ms)
1: [ RUN ] storage_parser_test.load_multiple_sample_types
1: [ OK ] storage_parser_test.load_multiple_sample_types (0 ms)
1: [ RUN ] storage_parser_test.load_unsupported_sample_type
1: [ OK ] storage_parser_test.load_unsupported_sample_type (0 ms)
1: [ RUN ] storage_parser_test.load_file_with_zero_sized_samples
1: [ OK ] storage_parser_test.load_file_with_zero_sized_samples (0 ms)
1: [ RUN ] storage_parser_test.load_nonexisting_file
1: [ OK ] storage_parser_test.load_nonexisting_file (0 ms)
1: [ RUN ] storage_parser_test.load_large_sample_data
1: [ OK ] storage_parser_test.load_large_sample_data (0 ms)
1: [ RUN ] storage_parser_test.load_many_small_samples
1: [ OK ] storage_parser_test.load_many_small_samples (0 ms)
1: [ RUN ] storage_parser_test.write_less_than_expected
1: [ OK ] storage_parser_test.write_less_than_expected (0 ms)
1: [ RUN ] storage_parser_test.read_fragmented_space
1: [ OK ] storage_parser_test.read_fragmented_space (0 ms)
1: [----------] 10 tests from storage_parser_test (0 ms total)
1:
1: [----------] 7 tests from flush_worker_test
1: [ RUN ] flush_worker_test.start_worker_in_correct_state
1: [ OK ] flush_worker_test.start_worker_in_correct_state (10 ms)
1: [ RUN ] flush_worker_test.stop_worker_complete
1: [ OK ] flush_worker_test.stop_worker_complete (10 ms)
1: [ RUN ] flush_worker_test.worker_function_called_on_stop
1: [ OK ] flush_worker_test.worker_function_called_on_stop (10 ms)
1: [ RUN ] flush_worker_test.multiple_stop_calls_are_safe
1: [ OK ] flush_worker_test.multiple_stop_calls_are_safe (10 ms)
1: [ RUN ] flush_worker_test.worker_factory_creates_valid_object
1: [ OK ] flush_worker_test.worker_factory_creates_valid_object (0 ms)
1: [ RUN ] flush_worker_test.worker_handles_invalid_path
1: [ OK ] flush_worker_test.worker_handles_invalid_path (10 ms)
1: [ RUN ] flush_worker_test.different_pid_start_stop
1: [ OK ] flush_worker_test.different_pid_start_stop (21 ms)
1: [----------] 7 tests from flush_worker_test (72 ms total)
1:
1: [----------] 5 tests from trace_cache_module_integration_test
1: [ RUN ] trace_cache_module_integration_test.buffer_fragmentation_handling
1: [ OK ] trace_cache_module_integration_test.buffer_fragmentation_handling (19 ms)
1: [ RUN ] trace_cache_module_integration_test.content_validation_edge_cases
1: [ OK ] trace_cache_module_integration_test.content_validation_edge_cases (19 ms)
1: [ RUN ] trace_cache_module_integration_test.stress_test_multiple_fragmentations
1: [ OK ] trace_cache_module_integration_test.stress_test_multiple_fragmentations (100 ms)
1: [ RUN ] trace_cache_module_integration_test.performance_write_test
1: [ OK ] trace_cache_module_integration_test.performance_write_test (276 ms)
1: [ RUN ] trace_cache_module_integration_test.concurrent_write_read_validation
1: [ OK ] trace_cache_module_integration_test.concurrent_write_read_validation (124 ms)
1: [----------] 5 tests from trace_cache_module_integration_test (540 ms total)
1:
1: [----------] 43 tests from sample_type_test
1: [ RUN ] sample_type_test.kernel_dispatch_sample_serialize_deserialize
1: [ OK ] sample_type_test.kernel_dispatch_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.kernel_dispatch_sample_get_size
1: [ OK ] sample_type_test.kernel_dispatch_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.kernel_dispatch_sample_type_identifier
1: [ OK ] sample_type_test.kernel_dispatch_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.memory_copy_sample_serialize_deserialize
1: [ OK ] sample_type_test.memory_copy_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.memory_copy_sample_get_size
1: [ OK ] sample_type_test.memory_copy_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.memory_copy_sample_type_identifier
1: [ OK ] sample_type_test.memory_copy_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.memory_allocate_sample_serialize_deserialize
1: [ OK ] sample_type_test.memory_allocate_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.memory_allocate_sample_get_size
1: [ OK ] sample_type_test.memory_allocate_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.memory_allocate_sample_type_identifier
1: [ OK ] sample_type_test.memory_allocate_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.region_sample_serialize_deserialize
1: [ OK ] sample_type_test.region_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.region_sample_get_size
1: [ OK ] sample_type_test.region_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.region_sample_type_identifier
1: [ OK ] sample_type_test.region_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.region_sample_empty_strings
1: [ OK ] sample_type_test.region_sample_empty_strings (0 ms)
1: [ RUN ] sample_type_test.in_time_sample_serialize_deserialize
1: [ OK ] sample_type_test.in_time_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.in_time_sample_get_size
1: [ OK ] sample_type_test.in_time_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.in_time_sample_type_identifier
1: [ OK ] sample_type_test.in_time_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.pmc_event_with_sample_serialize_deserialize
1: [ OK ] sample_type_test.pmc_event_with_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.pmc_event_with_sample_get_size
1: [ OK ] sample_type_test.pmc_event_with_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.pmc_event_with_sample_type_identifier
1: [ OK ] sample_type_test.pmc_event_with_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.amd_smi_sample_serialize_deserialize
1: [ OK ] sample_type_test.amd_smi_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.amd_smi_sample_get_size
1: [ OK ] sample_type_test.amd_smi_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.amd_smi_sample_type_identifier
1: [ OK ] sample_type_test.amd_smi_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.amd_smi_sample_empty_gpu_activity
1: [ OK ] sample_type_test.amd_smi_sample_empty_gpu_activity (0 ms)
1: [ RUN ] sample_type_test.cpu_freq_sample_serialize_deserialize
1: [ OK ] sample_type_test.cpu_freq_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.cpu_freq_sample_get_size
1: [ OK ] sample_type_test.cpu_freq_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.cpu_freq_sample_type_identifier
1: [ OK ] sample_type_test.cpu_freq_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.cpu_freq_sample_empty_freqs
1: [ OK ] sample_type_test.cpu_freq_sample_empty_freqs (0 ms)
1: [ RUN ] sample_type_test.backtrace_region_sample_serialize_deserialize
1: [ OK ] sample_type_test.backtrace_region_sample_serialize_deserialize (0 ms)
1: [ RUN ] sample_type_test.backtrace_region_sample_get_size
1: [ OK ] sample_type_test.backtrace_region_sample_get_size (0 ms)
1: [ RUN ] sample_type_test.backtrace_region_sample_type_identifier
1: [ OK ] sample_type_test.backtrace_region_sample_type_identifier (0 ms)
1: [ RUN ] sample_type_test.backtrace_region_sample_empty_strings
1: [ OK ] sample_type_test.backtrace_region_sample_empty_strings (0 ms)
1: [ RUN ] sample_type_test.type_identifier_enum_values
1: [ OK ] sample_type_test.type_identifier_enum_values (0 ms)
1: [ RUN ] sample_type_test.kernel_dispatch_sample_default_constructor
1: [ OK ] sample_type_test.kernel_dispatch_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.memory_copy_sample_default_constructor
1: [ OK ] sample_type_test.memory_copy_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.memory_allocate_sample_default_constructor
1: [ OK ] sample_type_test.memory_allocate_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.region_sample_default_constructor
1: [ OK ] sample_type_test.region_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.in_time_sample_default_constructor
1: [ OK ] sample_type_test.in_time_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.pmc_event_with_sample_default_constructor
1: [ OK ] sample_type_test.pmc_event_with_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.amd_smi_sample_default_constructor
1: [ OK ] sample_type_test.amd_smi_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.cpu_freq_sample_default_constructor
1: [ OK ] sample_type_test.cpu_freq_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.backtrace_region_sample_default_constructor
1: [ OK ] sample_type_test.backtrace_region_sample_default_constructor (0 ms)
1: [ RUN ] sample_type_test.kernel_dispatch_sample_large_values
1: [ OK ] sample_type_test.kernel_dispatch_sample_large_values (0 ms)
1: [ RUN ] sample_type_test.amd_smi_sample_large_gpu_activity
1: [ OK ] sample_type_test.amd_smi_sample_large_gpu_activity (0 ms)
1: [----------] 43 tests from sample_type_test (0 ms total)
1:
1: [----------] 1 test from first
1: [ RUN ] first.test
1: [ OK ] first.test (0 ms)
1: [----------] 1 test from first (0 ms total)
1:
1: [----------] Global test environment tear-down
1: [==========] 219 tests from 12 test suites ran. (1089 ms total)
1: [ PASSED ] 219 tests.
1/1 Test #1: rocprof-sys-unit-tests ........... Passed 1.09 sec

The following tests passed:
rocprof-sys-unit-tests

100% tests passed, 0 tests failed out of 1

Total Test time (real) = 1.11 sec

Submission Checklist

@habajpai-amd
habajpai-amd marked this pull request as ready for review December 9, 2025 14:05
Copilot AI review requested due to automatic review settings December 9, 2025 14:05
@habajpai-amd
habajpai-amd requested review from a team and jrmadsen as code owners December 9, 2025 14:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive unit tests for common utility functions that were centralized in PR #1249, specifically focusing on remove_env, path utilities, and discover_llvm_libdir_for_ompt. A bug in remove_env was also fixed where null entries were not being properly removed from the vector.

Key Changes:

  • Added 19 unit tests for remove_env function covering various scenarios including edge cases
  • Added 49 unit tests for path utilities including dirname, exists, symlinks, and path resolution functions
  • Added 18 unit tests for discover_llvm_libdir_for_ompt testing environment variable handling and fallback paths
  • Fixed bug in remove_env where null pointer filtering was incorrect
  • Updated existing test fixtures to follow m_ prefix naming convention

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test_update_env.cpp Updated member variable names to follow m_ prefix convention
test_remove_env.cpp New test file with 19 comprehensive test cases for remove_env function
test_path.cpp New test file with 49 test cases covering path utility functions
test_discover_llvm_libdir.cpp New test file with 18 test cases for LLVM library directory discovery
CMakeLists.txt Updated to include the three new test files in the build
environment.hpp Fixed bug in remove_env null entry filtering logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dgaliffiAMD dgaliffiAMD left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Just a few format changes that the formatter didn't catch. I might not have got them all, but I was just spacing out the functions.

Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_path.cpp
Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_path.cpp
Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_path.cpp
Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_path.cpp
Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_path.cpp
Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_path.cpp
@habajpai-amd
habajpai-amd force-pushed the users/habajpai-amd/common-utilities-unit-tests branch from 0597ceb to 19ef5fa Compare December 11, 2025 05:38
@habajpai-amd

Copy link
Copy Markdown
Contributor Author

Hi @adjordje-amd , @marantic-amd , @mradosav-amd , and @dgaliffiAMD -- when you get a chance, could one of you please review this PR? The RHEL-related checks are now passing.

Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_remove_env.cpp Outdated
Comment thread projects/rocprofiler-systems/cmake/GhcFilesystem.cmake
Comment thread projects/rocprofiler-systems/source/lib/common/tests/test_remove_env.cpp Outdated
@habajpai-amd
habajpai-amd force-pushed the users/habajpai-amd/common-utilities-unit-tests branch from cc53aa2 to 31db5b9 Compare December 17, 2025 17:06
@habajpai-amd
habajpai-amd merged commit b4e04b0 into develop Dec 18, 2025
83 of 86 checks passed
@habajpai-amd
habajpai-amd deleted the users/habajpai-amd/common-utilities-unit-tests branch December 18, 2025 05:33
systems-assistant Bot pushed a commit to ROCm/rocprofiler-systems that referenced this pull request Dec 18, 2025
 (#2237)

* test: add unit tests for common utilities from PR #1249

* incorporate review comments specific to tests formatting

* use filesystem API instead of std::system for safer cleanup

* Add ghc/filesystem submodule v1.5.14 for portable C++17 filesystem support

* fix: add cmake/GhcFilesystem.cmake for CI submodule auto-checkout

* incorporate review comment

* incorporate review comment
[rocm-systems] ROCm/rocm-systems#2237 (commit b4e04b0)
litvaOo pushed a commit that referenced this pull request Dec 18, 2025
* test: add unit tests for common utilities from PR #1249

* incorporate review comments specific to tests formatting

* use filesystem API instead of std::system for safer cleanup

* Add ghc/filesystem submodule v1.5.14 for portable C++17 filesystem support

* fix: add cmake/GhcFilesystem.cmake for CI submodule auto-checkout

* incorporate review comment

* incorporate review comment
dayatsin-amd added a commit that referenced this pull request Apr 7, 2026
…nal-merge-new-713 (#416)

* Move submodule definitions from projects/rccl/.gitmodules to root .gitmodules (#2298)

* Replace usages of __ockl_gws_init with __builtin_amdgcn_ds_gws_init (#2235)

* SWDEV-548892 - Always declare used ocml and ockl device libs functions (#2230)

Ignore __CLANG_HIP_RUNTIME_WRAPPER_INCLUDED__. This should not be relying
on declarations from the clang builtin headers. There is no issue declaring
the same intrinsics multiple times. This will enable removal of declarations
from the clang builtin headers.

* SWDEV-566268 - skip 2 failing tests on rock Windows (#2308)

* SWDEV-538607 - Add SIMDe as a build dependency, remove naked intrinsic use. (#500)

Co-authored-by: Alex Voicu <alexandru.voicu@amd.com>
Co-authored-by: Ioannis Assiouras <Ioannis.Assiouras@amd.com>

* [rocprofiler-sdk] Optimize rocprofiler-sdk `find_clients()` (#2267)

* Version bump and Changelog update for ROCm version 7.2 (#2201)

* Update projects/amdsmi/CHANGELOG.md
* Bump to 26.2.1
---------

Signed-off-by: gabrpham <Gabriel.Pham@amd.com>

* Run pre-commit's whitespace related hooks on projects/amdsmi (#2119)

* Run pre-commit's whitespace related hooks on projects/amdsmi

In order for pre-commit to be useful, everything needs to meet a common
baseline.

* Add whitespace back to Changelog for formatting

---------

Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>

* Git url fix (#2285)

* Update README-doc.md

Correct GitHub URL for components moved into rocm-systems

* Update amd_clr.rst

Update github.com URLs

* Update Dockerfile

Update rocm-systems paths

* Update CONTRIBUTING.md

update for rocm-systems

* Update CONTRIBUTING.md

minor change

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update hip_runtime_api.rst

Update for rocm-systems

* Update installation.rst

update URL to libhsakmt

* Update what_is_hip.rst

* Update projects/clr/CONTRIBUTING.md

Co-authored-by: Dominic Widdows <dwiddows@gmail.com>

* Update projects/clr/README-doc.md

Co-authored-by: Dominic Widdows <dwiddows@gmail.com>

* Update Dockerfile

Update git clone for sparse checkout

* Update projects/hip/CONTRIBUTING.md

* Update projects/clr/CONTRIBUTING.md

* Update projects/hipother/CONTRIBUTING.md

---------

Co-authored-by: Dominic Widdows <dwiddows@gmail.com>

* Enable Lintian Support for ROCM-SMI, ROCMINFO (#1650)

* Enable Lintian Support for ROCM-SMI

* Enable Lintian Support for ROCMINFO

* Updated Lintian Override File Processing

* Update UT Fix for Lintian rocmsmi,rocminfo

* Update UT Fixes, Review Comments

* Update Review Comments - removed extra white spaces, added error check for gzip, date commands

* Update Review Comments - Correcting License Type

* Sync Lintian ChangeLog

* Changelog data sync enhanced

* Update Review Comments, UT fix

* white space cleanup - precommit check

* [rocprofiler-systems] Add cached demangler and replace old demangle (#2135)

* Add cached demangler and replace old

* Add unit tests

* Applied suggestions from code review

* Applied suggestions from code review

* hsakmt: Expose and use CWSR and Control stack sizes (#2200)

* hsakmt: Expose CWSR and Control stack sizes

This is better than hardcoding values and hoping that they align with
KFD's definitions

Signed-off-by: Kent Russell <kent.russell@amd.com>

* hsakmt: Use CwsrSize and CtlStackSize if available

If KFD is providing the CwsrSize and CtlStackSize, use the maximum
of those and the old calculations for the ctx_save_restore_size
and ctl_stack_size defined in the queue

Signed-off-by: Kent Russell <kent.russell@amd.com>

* hsakmt: Add warning when ABI<1.20 on GFX1151

CwsrSize and CtlStackSize are reported by KFD ABI 1.20. GFX1151
specifically may have some issues if these regions are misaligned, so
report a strong warning during topology initialization if the system is
GFX1151 but is using KFD ABI < 1.20

Signed-off-by: Kent Russell <kent.russell@amd.com>

---------

Signed-off-by: Kent Russell <kent.russell@amd.com>

* [rocprofiler-systems] Add span (#2142)

* Add span
* Update unit tests

* [SWDEV-565460] AMD SMI Document Multiple Init Best Practices (#2293)

* [SWDEV-565460] AMD SMI Document Multiple Init Best Practices

Signed-off-by: amd-josnarlo <josnarlo.amd.com>

* Add sphinxcontrib-mermaid to render diagram in HTML

bump rocm-docs-core to 1.31.0
pip-compile requirements.txt

---------

Signed-off-by: amd-josnarlo <josnarlo.amd.com>
Co-authored-by: amd-josnarlo <josnarlo.amd.com>
Co-authored-by: Peter Park <peter.park@amd.com>

* Adding org var and dynamic selection of targets (#2317)

* Added AMDSMI CI to rocm-systems(#2074)

Signed-off-by: Justin Williams <Justin.Williams@amd.com>

* [rocprofiler-compute][tui] menu bar lag fix (#1942)

* [rocprofiler-compute] Counter accuracy tests and improvements for iteration multiplexing (#2011)

* Added laplace solver in samples

* Add laplace eqn in CMake

* Added counter accuracy test

* Add iteration CLI arg for laplace eq

* Unnest profile method

* Missing counter warning

* Updated insufficient kernel warning

* Added reference for laplace equation

* variable name change

* Added comments for data comparison

* Included scipy as test requirement

* Added line number for ref

* split stochastic and deterministic tests

* Added order cli option for laplace_eqn

* Install laplace eqn

* Missing counter warning

* Warn about missing kernels during analysis

* Update tests

* Split iteration multiplexing ctests

* Updated warning

* Incorporated copilot's suggestions

* [RDC] Optimize RDC counter sampling with greedy packing algorithm (#1590)

* Optimize RDC counter sampling with greedy packing algorithm

This change significantly reduces the number of rocprofiler-sdk sample calls
by implementing a greedy packing algorithm that groups multiple counters into
the minimal number of hardware profiles.

Key improvements:
- Implement greedy packing algorithm to combine counters into minimal profiles
- Add ProfileSet structure to manage packed counter configurations
- Cache packed profile sets for reuse across queries
- Group telemetry field requests by GPU for bulk processing
- Reduce sample calls by ~35% (from 100 to 65 for typical workloads)

Performance impact:
- 13 counters now packed into 3 profiles (77% compression)
- Reduces overhead from profile creation and context switching
- More efficient utilization of hardware counter resources

Implementation details:
- Added create_profiles_for_counters() using greedy algorithm
- Added sample_counters_with_packing() for bulk sampling
- Modified telemetry layer to use rocp_lookup_bulk()
- Preserves all field transformations and special handling

Testing shows successful packing with expected performance gains.
No functional changes to external APIs or behavior.

Co-Authored-By: Ben Welton <bwelton@amd.com>

* Address PR review feedback

This commit addresses all review comments from the initial PR:

1. Fix division by zero risk in debug logging
   - Added check for empty counters vector before calculating compression ratio
   - Avoids potential division by zero when logging profile creation stats

2. Improve thread safety for statistics tracking
   - Changed static uint64_t to std::atomic<uint64_t> for thread-safe counters
   - Prevents race conditions in multi-threaded sampling scenarios

3. Remove unused variable
   - Removed unused profile_index variable that was incremented but never used
   - Cleaned up dead code

4. Clean up code formatting
   - Removed extra blank lines for consistency
   - Applied formatting fixes across modified files

5. Refactor code duplication between rocp_lookup and rocp_lookup_bulk
   - Created apply_field_transformation() helper function
   - Eliminates ~70 lines of duplicated switch statement logic
   - Centralizes field transformation logic in single location
   - Makes future maintenance easier

6. Document non-rocprofiler metrics handling
   - Added comments explaining how bulk lookup handles special cases
   - Clarifies that non-profiler fields like KFD_ID are handled in transformation

All changes maintain backward compatibility and pass compilation.

Co-Authored-By: Ben Welton <bwelton@amd.com>

---------

Co-authored-by: Ben Welton <bwelton@amd.com>
Co-authored-by: Adam Pryor <61172547+adam360x@users.noreply.github.com>

* Scale down memory usage data when the actual data is stored to cache (#2343)

* Add HasExpertSchedMode device prop (#2241)

* Add HasExpertSchedMode device prop

* Add unit tests for HasExpertSchedMode

* Add gfx12 check for HasExpertSchedMode prop

* Update gfx major version check and test for ExpertSchedMode

* Minor fix and ROCr version bump

* Update projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h

* Update projects/rocr-runtime/runtime/hsa-runtime/inc/hsa_ext_amd.h

* Apply suggestion from @dayatsin-amd

* Apply suggestion from @dayatsin-amd

---------

Co-authored-by: Stefan Sokolovic <stefan.sokolovic2@amd.com>
Co-authored-by: David Yat Sin <77975354+dayatsin-amd@users.noreply.github.com>

* SWDEV-571304 : Fix the constructor for __half (#2240)

- comply with cuda

- Fix usecase for constexpr

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>

* rocr: Fix asyncHandler segfault (#2261)

Fix initialization order for the async events handler. The polling
thread would launch before the wake signal is initialized.

* Revert "Add HasExpertSchedMode device prop (#2241)" (#2371)

This reverts commit c0b4aef.

* test: add unit tests for common utilities from PR #1249 (#2237)

* test: add unit tests for common utilities from PR #1249

* incorporate review comments specific to tests formatting

* use filesystem API instead of std::system for safer cleanup

* Add ghc/filesystem submodule v1.5.14 for portable C++17 filesystem support

* fix: add cmake/GhcFilesystem.cmake for CI submodule auto-checkout

* incorporate review comment

* incorporate review comment

* Do not allocate code objects when we map a static code object (#2332)

* [SWDEV-566924] Update KFD_ID metric to use amd-smi instead of rocprof (#2355)

* [rocprofiler-compute] Improve iteration multiplexing code and documentation (#2080)

* Improve Iteration multiplexing

* Improve iteration multiplexing documentation by adding usage note and
  listing caveats

* Bugfixes for iteration mulitplexing
    * Use merge iteration multiplexing in analysis webui and db mode
    * Do not remove Dispatch_ID column in merge iteration multiplexing
      since it is needed for analysis of top dispatches based on
duration

* Bugfixes for analysis logic
    * Graceful handling of missing counters in case of iteration
      multiplexing
    * Improved warnings when metrics could not be calculated due to
      missing counter data
    * Fix the check to prevent showing table when a column is full of
      N/A
    * Improve detection of empty values when metric evaludation fails
      due to missing counter data

* Bugfixes for profile logic
    * Fix kernel filtering during roofline benchmark phase

* Update changelog for bugfixes

* Remove unnecessary columns when merging dispatches for iteration multiplexing

* bugfix

* Better analysis warnings

* fix to_std() in parser

* Use median in merge iteration multiplex

* Address review comments

* Fix cmake formatting

* fix None handling of parser util functions

* Enable stochastic counter accuracy test

* fix cmake formatting

* [rocprofiler-compute] Add SDK dependency to rocprofiler-compute-tarball.yml workflow (#2329)

* Install rocm-dev in rocprofiler-compute-tarball.yml workflow

* Update paths for push and PR for rocprofiler-compute-tarball.yml

* Add ROCm dependencies to disttest job

* cmake fix binary link creation and fix format

* Use python3 instead of python3.9 in RHEL 8 and RHEL 9 workflows

* set default python3 to python3.9 in rhel8

* Try alternatives setup for python3 in RHEL8 env

* Add pip install cmake to debug RHEL8 issue

* Remove python3.11 in RHEL8 workflow

* Add back comment regarding RHEL8

---------

Co-authored-by: Vignesh Edithal <Vignesh.Edithal@amd.com>

* Revert "clr: Minor fixes for error return" (#2399)

- This reverts commit 8dd8436.
- Resolve MIOpen test failures observed in TheRock
- TheRock Issue: ROCm/TheRock#2642
- room-systems issue: #2400

* fix: prevent double-free crash during process exit in amd-smi (#2213)

* [SWDEV-525635] Updated output file handling options (#1896)

Currently if the input file name already exists, the tool
appends output to existing file. Added overwrite, append,
or no(discard) options to choose from.

Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>
Co-authored-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>

* SWDEV-548892 - Stop using __ockl_lane_id (#2186)

__lane_id already exists and is identical.

* SWDEV-565304 - Pass numa node to migrate pages correctly (#1729)

* SWDEV-565304 - Pass cpuId of the the thread currently running

* SWDEV-565304 - Numa id to be returned

* SWDEV-565304 - Numa id to be returned

* SWDEV-572329 - Remove barrier packet (#2304)

* SWDEV-572676 - adjust tile size to 32 in Unit_hipCGThreadBlockTileType for Navi4x (#2379)

* SWDEV-572676 - adjust tile size to 32 for Navi4x

* SWDEV-572676 - change tile size from fixed value to warp size

* Revert "Adding org var and dynamic selection of targets (#2317)" (#2416)

This reverts commit c9ac018.

* Fixed ctests (#2406)

* [rocprofiler-systems] Improve metadata parsing (#2238)

* Improve metadata JSON parsing
* Fix string ownership

* Put cached perfetto traces as default one (#2138)

* Put cached perfetto traces as default one

* Improve cached data and perfetto traces in order to be more aligned with E2E tests

* Addressing PR comments and findings

* Force early instrumentation bundle instantiation

* Sync-up insturumented containers with thread growth data

* Revert ompvv number of host threads to default 8

* Fixed counter track namings for amd-smi

* AIPROFSYST-34 [rocprof-sys] Update documentation describing newly introduced changes to default tracing mechanism

* Adding full build capability to theROCK for HIP changes (#2003)

## Add Full Build Capability to theROCK for HIP

### Summary
This PR adds full build support to **theROCK** for HIP-related changes, ensuring that all components are built.

### Changes
- Enabled full build coverage for the following projects:
  - `projects/clr`
  - `projects/hip`
  - `projects/hip-tests`
  - `projects/rocr-runtime`
- Updated build configuration to include all targets for the above projects.
- Ensured rocm-libraries is pulled to build optional components.

### Motivation
These changes are required to support HIP development and testing within theROCK by ensuring all components are built together. This improves reliability, integration testing.

* [Documentaion] updating roctx library linkage documentation (#2251)

* Add CODEOWNERS for rocprofiler-sdk project (#2427)

## Motivation

Missing CODEOWNERS for ROCProfiler-SDK

<!-- Explain the purpose of this PR and the goals it aims to achieve. -->

## Technical Details

Add CODEOWNERS for rocprofiler-sdk project

<!-- Explain the changes along with any relevant GitHub links. -->

## JIRA ID

<!-- If applicable, mention the JIRA ID resolved by this PR (Example: Resolves SWDEV-12345). -->
<!-- Do not post any JIRA links here. -->

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->

## Test Result

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [X] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.

* [Rocprof-Sys] Resolve crash when profiling TensorFlow GPU application (#2381)

* fix: resolve crash when profiling TensorFlow GPU application

* incorporate review comments

* updated min_rows from 3 to 2 for threads table validation as internal threads are not profiled and are now correctly bypassed

* [rocpd] Write rocpd yaml files as a list, even when only 1 file (#2288)

* [rocprofiler-systems] Add SIGKILL delay option (#2384)

## Motivation

When profiling multi-process applications where a parent process sends SIGKILL to child processes, the termination can occur before the profiler has a chance to flush collected data. This PR introduces a configurable delay before SIGKILL signals are forwarded, allowing profiling data to be captured before process termination. This is workaround.

## Technical Details

- Added new configuration setting `ROCPROFSYS_KILL_DELAY` (default: 0 seconds) to specify a delay before SIGKILL signals are forwarded to other processes
- Implemented `kill_gotcha` component that intercepts the `kill()` system call
- The gotcha only delays SIGKILL signals sent to external processes (pid > 0 and not self)
- Integrated `kill_gotcha_t` into the `preinit_bundle_t` for early initialization

* SWDEV-555178 - Calculate phys mem offset for remap range (#1879)

* [rocprofiler-compute] Fix for multi process workload profiling (#2418)

* Fix for multi process workload profiling

Native counter collection tool updates:
    * Do not dump empty counter data for a process
    * Use PID instead of UUID for dumped csv files to facilitate correlation
    * Handle merging multiple pairs of rocpd (from sdk tool) and csv (from
      native tool) files
    * Handle merging multiple pairs of csv (from sdk tool) and csv (from
      native tool) files

Rocpd output format updates:
    * Merge multiple rocpd databases into a single csv
    * Reset dispatch id and kernel id for unique dispatches and unique
      kernels respectively
    * Retain multiple rocpd databases per run for multi process workloads

* Add test case for multiprocess profiling using rocflop workload

* Add rocflop

* Fix native counter csv to rocprofv3 csv conversion

* Use kernel_id instead of dispatch_id to correlate native counter csv
  and kernel trace csv

* python formatting using ruff 0.14 instead of 0.13

* [rocprofiler-compute] Test env. vars. in rocprofiler-sdk backend (#2414)

* Test env. vars. in rocprofiler-sdk backend

* Improve rocprofiler-sdk backend test case to check for env. vars. and
  ensure we do not overwrite irrelevant env. vars.

* Remove unnecessary usage of ROCPROF_INDIVIDUAL_XCC_MODE env. var.

* Formatting fixes

* Test fixes

* Remove redundant code in tests

* Remove usage of utils_mod and use utils instead, this prevents
  duplicate imports

* [rocprofiler-compute] Faster counter accuracy testing (#2420)

* Faster counter accuracy testing

* Better handle SPI_CSN_* metrics for lesser than MI350 series

* Use metric filtering to collect only relevant counters for comparison

* Ensure all workload folders are deleted after testing is completed

* Dont use clean_existing=False

* Add manual test for all counter accuracy

* Revert "Adding full build capability to theROCK for HIP changes (#2003)" (#2441)

This reverts commit 0a52f5c.

Reverts #2003

MIOpen build failures on windows causing blockers on unrelated file changes.

* SWDEV-558849 - keep the lastEnqueueCommand_ when PAL backend is enabled (#2320)

* [SWDEV-566543] Fix param validation in FrequenciesRead test (#2430)

Fixed incorrect error code expectation in FrequenciesRead
test when calling amdsmi_get_gpu_pci_bandwidth() with nullptr
parameter.

Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>

* Fix agent device ID in the cached kernel_dispatch trace (#2452)

* Remove redundant ROCPROFSYS_TRACE_CACHED variable from the code (#2434)

* [rocprofiler-compute] Write raw counter and metric values (#2314)

* Added tool for dumping counter and metric values

* Skip Linting

* Added support for iteration multiplexing

* Remove subparser and supress compute options

* Specify output dir

* Add kernel info

* csv name change

* Added comments

* Support dispatch id-less dataframes

* Formatting fix

* Add default for path

* Print help with no args

* Support only single workload

* [rocprofiler-compute] Fix merging logic for multi process (#2445)

* Fix merging logic for multi process

* Fix dispatch id reset logic in case of rocpd format

* Fix kernel id reset logic in case of csv format

* Revert correlation logic change in csv format

* Do inner join instead of left join

* Remove SMFMAC functionality in rocflop sample since its not supported in MI100 (#2456)

* SWDEV-558849 - Fix Windows build for ROCR backend (#2368)

* [SWDEV-548460] Add RDC Policy Reset Message (#2180)

* [SWDEV-548460] Add RDC Policy Reset Message

* [rdc] Bump version to 1.3.0

Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>

* chore: [rdc] Format CMakeLists.txt

Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>

---------

Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Co-authored-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>

* SWDEV-567545 - Implement block_rank in co-op grid groups (#2182)

* SWDEV-567545 - Implement block_rank in co-op grid groups

* Fix test cases (#2462)

* [SWDEV-567254] Sync Unified and Linux header (#2220)

* [SWDEV-567254] Sync Unified and Linux header

Signed-off-by: Joseph Narlo <joseph.narlo@amd.com>

* Latest sync changes

* Sync

* Add back guest_windows tag

* Sync

---------

Signed-off-by: Joseph Narlo <joseph.narlo@amd.com>
Co-authored-by: amd-josnarlo <josnarlo.amd.com>

* SWDEV-573589 - Fixed performance regression due to the increase of the signal pool (#2470)

* [rocprofiler-register] Fix compilation with libc++ (#1241)

`tests/rocprofiler/rocprofiler.cpp` uses `std::string` without including `<string>` directly.
This works with libstdc++ due to transitive includes, but fails with libc++.

Closes #1240

* Update using-rocprofv3-with-openmp.rst (#2473)

* [rocprofiler-compute] Improve roofline logging for roofline.csv (#2390)

* enhanced roofline log output for graceful exit

* addressed comment, added block filtering

* ruff format

---------

Signed-off-by: gabrpham <Gabriel.Pham@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Signed-off-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: amd-josnarlo <josnarlo.amd.com>
Signed-off-by: Justin Williams <Justin.Williams@amd.com>
Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Signed-off-by: Joseph Narlo <joseph.narlo@amd.com>
Co-authored-by: Jason Bonnell <166553723+jbonnell-amd@users.noreply.github.com>
Co-authored-by: Fábio Mestre <fabio.mestre@amd.com>
Co-authored-by: Matt Arsenault <Matthew.Arsenault@amd.com>
Co-authored-by: Ajay GunaShekar <86270081+agunashe@users.noreply.github.com>
Co-authored-by: systems-assistant[bot] <221163467+systems-assistant[bot]@users.noreply.github.com>
Co-authored-by: Alex Voicu <alexandru.voicu@amd.com>
Co-authored-by: Ioannis Assiouras <Ioannis.Assiouras@amd.com>
Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
Co-authored-by: gabrpham <Gabriel.Pham@amd.com>
Co-authored-by: Mario Limonciello <superm1@kernel.org>
Co-authored-by: randyh62 <42045079+randyh62@users.noreply.github.com>
Co-authored-by: Dominic Widdows <dwiddows@gmail.com>
Co-authored-by: arvindcheru <90783369+arvindcheru@users.noreply.github.com>
Co-authored-by: Milan Radosavljevic <milan.radosavljevic@amd.com>
Co-authored-by: Kent Russell <kent.russell@amd.com>
Co-authored-by: Aleksandar Djordjevic <aleksandar.djordjevic@amd.com>
Co-authored-by: Joseph Narlo <joseph.narlo@amd.com>
Co-authored-by: Peter Park <peter.park@amd.com>
Co-authored-by: Geo Min <geomin12@amd.com>
Co-authored-by: amd-juwillia <Justin.Williams@amd.com>
Co-authored-by: xuchen-amd <xuchen@amd.com>
Co-authored-by: abchoudh-amd <abchoudh@amd.com>
Co-authored-by: Benjamin Welton <Benjamin.Welton@amd.com>
Co-authored-by: Ben Welton <bwelton@amd.com>
Co-authored-by: Adam Pryor <61172547+adam360x@users.noreply.github.com>
Co-authored-by: marantic-amd <marantic@amd.com>
Co-authored-by: Filip Jankovic <161825881+fjankovi@users.noreply.github.com>
Co-authored-by: Stefan Sokolovic <stefan.sokolovic2@amd.com>
Co-authored-by: David Yat Sin <77975354+dayatsin-amd@users.noreply.github.com>
Co-authored-by: Shadi Dashmiz <94885391+shadidashmiz@users.noreply.github.com>
Co-authored-by: Maneesh Gupta <maneesh.gupta@amd.com>
Co-authored-by: habajpai-amd <habajpai@amd.com>
Co-authored-by: Jatin Chaudhary <51944368+cjatin@users.noreply.github.com>
Co-authored-by: vedithal-amd <Vignesh.Edithal@amd.com>
Co-authored-by: Sourabh U Betigeri <sourabhbetigeri@gmail.com>
Co-authored-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>
Co-authored-by: cadolphe-amd <chris.adolphe@amd.com>
Co-authored-by: ammallya <ameyakeshava.mallya@amd.com>
Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
Co-authored-by: Ammar ELWazir <ammar.elwazir@amd.com>
Co-authored-by: Young Hui - AMD <145490163+yhuiYH@users.noreply.github.com>
Co-authored-by: marandje <marko.arandjelovic@amd.com>
Co-authored-by: Ioannis Assiouras <38722728+iassiour@users.noreply.github.com>
Co-authored-by: German Andryeyev <56892148+gandryey@users.noreply.github.com>
Co-authored-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Co-authored-by: Jimbo <57198431+jiabaxie@users.noreply.github.com>
Co-authored-by: Sv. Lockal <AngryLoki@users.noreply.github.com>
Co-authored-by: Swati Rawat <120587655+SwRaw@users.noreply.github.com>
Co-authored-by: jamessiddeley-amd <James.Siddeley@amd.com>
Co-authored-by: Sivasuntharampillai, Haresh <Haresh.Sivasuntharampillai@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants