Skip to content

[SWDEV-563823][Compiler-rt][ASan] Simplify API Logic 'asan_hsa_amd_…#858

Merged
ronlieb merged 1 commit intoROCm:amd-mainlinefrom
ampandey-AMD:cp-d82664fd15a57297e8bdfe45ebdb40b7c776a9d8
Dec 17, 2025
Merged

[SWDEV-563823][Compiler-rt][ASan] Simplify API Logic 'asan_hsa_amd_…#858
ronlieb merged 1 commit intoROCm:amd-mainlinefrom
ampandey-AMD:cp-d82664fd15a57297e8bdfe45ebdb40b7c776a9d8

Conversation

@ampandey-AMD
Copy link

…ipc_memory_create'. (#475)

  • Use reinterpret_cast for pointer arithmetic.
  • Add sanitizer interception logic for api 'hsa_amd_pointer_info'.
  • Allow only valid values of ptr and len in non-ASan mode.
    • ptr == Actual agentBaseAddress && len == original_len_used_in_alloc
  • Allow only valid values of ptr and len in ASan mode.
    • Here pinfo is retrieved from external hsa_amd_pointer_info(not internal device allocator function AmdgpuMemFuncs::GetPointerInfo) - ptr == pinfo.agentBaseAddress && len == pinfo.sizeInBytes
    • ptr == original_ptr_returned_by_ASAN && len == original_len_used_in_alloc

…pc_memory_create'. (ROCm#475)

- Use reinterpret_cast<uptr> for pointer arithmetic.
 - Add sanitizer interception logic for api 'hsa_amd_pointer_info'.
 - Allow only valid values of ptr and len in non-ASan mode.
    - ptr == Actual agentBaseAddress && len ==
      original_len_used_in_alloc
 - Allow only valid values of ptr and len in ASan mode.
    - Here pinfo is retrieved from external hsa_amd_pointer_info(not
      internal device allocator function AmdgpuMemFuncs::GetPointerInfo)
      - ptr == pinfo.agentBaseAddress && len == pinfo.sizeInBytes
    - ptr == original_ptr_returned_by_ASAN && len ==
      original_len_used_in_alloc
@ampandey-AMD ampandey-AMD requested a review from bing-ma December 16, 2025 06:16
@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@z1-cciauto
Copy link
Collaborator

Copy link
Collaborator

@b-sumner b-sumner left a comment

Choose a reason for hiding this comment

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

LGTM!

@ampandey-AMD
Copy link
Author

ampandey-AMD commented Dec 17, 2025

Not sure about this error in the replay CI 714

[2025-12-16T19:16:14.845Z] + cmake -DCMAKE_PREFIX_PATH=/opt/rocm-7.2.0/lib/llvm;/opt/rocm-7.2.0 -DCMAKE_SHARED_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ORIGIN -DCMAKE_EXE_LINKER_FLAGS_INIT=-Wl,--enable-new-dtags,--build-id=sha1,--rpath,$ORIGIN/../lib -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=FALSE -DCMAKE_INSTALL_PREFIX=/opt/rocm-7.2.0 -DCMAKE_PACKAGING_INSTALL_PREFIX=/opt/rocm-7.2.0 -DROCM_SYMLINK_LIBS=OFF -DCPACK_PACKAGING_INSTALL_PREFIX=/opt/rocm-7.2.0 -DROCM_DISABLE_LDCONFIG=ON -DCPACK_SET_DESTDIR=OFF -DCPACK_RPM_PACKAGE_RELOCATABLE=ON -DROCM_PATH=/opt/rocm-7.2.0 -DAMDGPU_TARGETS=gfx90a -DGPU_TARGETS=gfx90a -DCMAKE_HIP_ARCHITECTURES=gfx90a -DCPACK_DEBIAN_DEBUGINFO_PACKAGE=FALSE -DCPACK_RPM_DEBUGINFO_PACKAGE=FALSE -DCPACK_RPM_INSTALL_WITH_EXEC=FALSE -DCMAKE_BUILD_TYPE=Release -DMIOPEN_BACKEND=HIP -DMIOPEN_OFFLINE_COMPILER_PATHS_V2=1 -DCMAKE_CXX_COMPILER=/opt/rocm-7.2.0/lib/llvm/bin/clang++ -DCMAKE_C_COMPILER=/opt/rocm-7.2.0/lib/llvm/bin/clang -DCMAKE_PREFIX_PATH=/opt/rocm-7.2.0;/opt/rocm-7.2.0/hip;/home/jenkins/agent/workspace/compiler-psdb-amd-mainline/Libs/MIOpen/deps_hip -DHIP_OC_COMPILER=/opt/rocm-7.2.0/bin/clang-ocl -DMIOPEN_TEST_DISCRETE=OFF /home/jenkins/agent/workspace/compiler-psdb-amd-mainline/Libs/MIOpen
[2025-12-16T19:16:14.845Z] -- The C compiler identification is Clang 22.0.0
[2025-12-16T19:16:14.845Z] -- The CXX compiler identification is Clang 22.0.0
[2025-12-16T19:16:14.845Z] -- Detecting C compiler ABI info
[2025-12-16T19:16:14.845Z] -- Detecting C compiler ABI info - done
[2025-12-16T19:16:14.845Z] -- Check for working C compiler: /opt/rocm-7.2.0/lib/llvm/bin/clang - skipped
[2025-12-16T19:16:14.845Z] -- Detecting C compile features
[2025-12-16T19:16:14.845Z] -- Detecting C compile features - done
[2025-12-16T19:16:14.845Z] -- Detecting CXX compiler ABI info
[2025-12-16T19:16:15.107Z] -- Detecting CXX compiler ABI info - done
[2025-12-16T19:16:15.107Z] -- Check for working CXX compiler: /opt/rocm-7.2.0/lib/llvm/bin/clang++ - skipped
[2025-12-16T19:16:15.107Z] -- Detecting CXX compile features
[2025-12-16T19:16:15.107Z] -- Detecting CXX compile features - done
[2025-12-16T19:16:15.373Z] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[2025-12-16T19:16:15.636Z] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
[2025-12-16T19:16:15.636Z] -- Found Threads: TRUE  
[2025-12-16T19:16:15.636Z] CMake Deprecation Warning at /opt/rocm-7.2.0/share/rocm/cmake/ROCMConfig.cmake:12 (message):
[2025-12-16T19:16:15.636Z]   Use of find_package(ROCM) is deprecated as of ROCm 6.4.  Please use
[2025-12-16T19:16:15.636Z]   find_package(ROCmCMakeBuildTools)
[2025-12-16T19:16:15.636Z] Call Stack (most recent call first):
[2025-12-16T19:16:15.636Z]   CMakeLists.txt:83 (find_package)
[2025-12-16T19:16:15.636Z] 
[2025-12-16T19:16:15.636Z] 
[2025-12-16T19:16:15.636Z] -- Found SQLite3: /usr/include (found version "3.37.2") 
[2025-12-16T19:16:15.636Z] -- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so (found version "1.0.8") 
[2025-12-16T19:16:15.636Z] -- Looking for BZ2_bzCompressInit
[2025-12-16T19:16:15.636Z] -- Looking for BZ2_bzCompressInit - found
[2025-12-16T19:16:15.636Z] -- Found nlohmann_json: /usr/lib/cmake/nlohmann_json/nlohmann_jsonConfig.cmake (found suitable version "3.10.5", minimum required is "3.9.1") 
[2025-12-16T19:16:15.636Z] -- MIOPEN_WORKAROUND_USE_BOOST_FILESYSTEM OFF
[2025-12-16T19:16:15.636Z] -- Performing Test HAS_HIP
[2025-12-16T19:16:16.590Z] -- Performing Test HAS_HIP - Success
[2025-12-16T19:16:16.590Z] -- Performing Test _HAS_LIB_STD_FILESYSTEM
[2025-12-16T19:16:16.590Z] -- Performing Test _HAS_LIB_STD_FILESYSTEM - Success
[2025-12-16T19:16:16.590Z] -- MIOPEN_OFFLINE_COMPILER_PATHS_V2: 1
[2025-12-16T19:16:16.590Z] -- MIOPEN_BUILD_DRIVER: ON
[2025-12-16T19:16:16.590Z] -- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS
[2025-12-16T19:16:16.590Z] -- Performing Test HIP_CLANG_SUPPORTS_PARALLEL_JOBS - Success
[2025-12-16T19:16:16.590Z] -- Build with HIP 7.2.25451 /opt/rocm-7.2.0/lib/cmake/hip
[2025-12-16T19:16:16.590Z] -- Enable Composable Kernels: ON
[2025-12-16T19:16:16.590Z] -- Performing Test MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK
[2025-12-16T19:16:17.983Z] -- Performing Test MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK - Success
[2025-12-16T19:16:17.983Z] -- Hip compiler flags:  -x hip   -D__HIP_PLATFORM_AMD__=1  -DUSE_PROF_API=1 --hip-link   -fno-offload-uniform-block 
[2025-12-16T19:16:17.983Z] -- OpenCL compiler: /opt/rocm-7.2.0/bin/clang-ocl
[2025-12-16T19:16:18.245Z] -- Build with rocblas 5.2.0 /opt/rocm-7.2.0/lib/cmake/rocblas
[2025-12-16T19:16:18.245Z] -- Build with hipBLASLt 1.2.0 /opt/rocm-7.2.0/lib/cmake/hipblaslt
[2025-12-16T19:16:18.245Z] -- Build with hipBLAS-common 1.4.0 
[2025-12-16T19:16:18.245Z] -- HIP backend selected.
[2025-12-16T19:16:18.246Z] -- clang-offload-bundler found: /opt/rocm-7.2.0/llvm/bin/clang-offload-bundler
[2025-12-16T19:16:18.246Z] -- Could NOT find rocMLIR (missing: rocMLIR_DIR)
[2025-12-16T19:16:18.246Z] -- Falling back to find library libMLIRMIOpen
[2025-12-16T19:16:18.246Z] CMake Error at CMakeLists.txt:445 (find_library):
[2025-12-16T19:16:18.246Z]   Could not find LIBMLIRMIOPEN using the following names: MLIRMIOpen
[2025-12-16T19:16:18.246Z] 
[2025-12-16T19:16:18.246Z] 
[2025-12-16T19:16:18.246Z] -- Configuring incomplete, errors occurred!
[2025-12-16T19:16:18.246Z] See also "/home/jenkins/agent/workspace/compiler-psdb-amd-mainline/Libs/MIOpen/build_hip/CMakeFiles/CMakeOutput.log".

@ampandey-AMD
Copy link
Author

ampandey-AMD commented Dec 17, 2025

It seems MLIRMIOpen dependency library missing in the build of MIOpen.
Previsouly , there seems to be an issue created for the above related cmake error.

@ampandey-AMD ampandey-AMD requested a review from ronlieb December 17, 2025 06:06
@ronlieb ronlieb merged commit 3387069 into ROCm:amd-mainline Dec 17, 2025
12 of 13 checks passed
@ampandey-AMD ampandey-AMD deleted the cp-d82664fd15a57297e8bdfe45ebdb40b7c776a9d8 branch December 18, 2025 09:05
@ampandey-AMD ampandey-AMD restored the cp-d82664fd15a57297e8bdfe45ebdb40b7c776a9d8 branch December 19, 2025 09:17
@ampandey-AMD ampandey-AMD deleted the cp-d82664fd15a57297e8bdfe45ebdb40b7c776a9d8 branch December 19, 2025 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants