[Mlir-commits] [mlir] 2f8d8c7 - Generalize finding the rocm_agent_enumberator program

Krzysztof Drewniak llvmlistbot at llvm.org
Wed Aug 2 13:35:59 PDT 2023


Author: Krzysztof Drewniak
Date: 2023-08-02T20:35:54Z
New Revision: 2f8d8c78a89ea86c602db38ee63f48f5a8229b36

URL: https://github.com/llvm/llvm-project/commit/2f8d8c78a89ea86c602db38ee63f48f5a8229b36
DIFF: https://github.com/llvm/llvm-project/commit/2f8d8c78a89ea86c602db38ee63f48f5a8229b36.diff

LOG: Generalize finding the rocm_agent_enumberator program

On Fedora, rocminfo is a fedora package and rocm_agent_enumberator is
installed to /usr/bin.  This causes this error when building.

CMake Error at external/llvm-project/mlir/lib/ExecutionEngine/CMakeLists.txt:232 (message):
  Could not run rocm_agent_enumerator and ROCM_TEST_CHIPSET is not defined

So use find_program() to look for rocm_agent_enumerator instead of assuming a
single location.

Signed-off-by: Tom Rix <trix at redhat.com>

Reviewed By: krzysz00

Differential Revision: https://reviews.llvm.org/D156826

Added: 
    

Modified: 
    mlir/lib/ExecutionEngine/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/mlir/lib/ExecutionEngine/CMakeLists.txt b/mlir/lib/ExecutionEngine/CMakeLists.txt
index 39cc9c060db784..ea33c2c6ed261e 100644
--- a/mlir/lib/ExecutionEngine/CMakeLists.txt
+++ b/mlir/lib/ExecutionEngine/CMakeLists.txt
@@ -262,11 +262,15 @@ if(LLVM_ENABLE_PIC)
     set(CMAKE_PREFIX_PATH "${REAL_CMAKE_PREFIX_PATH}")
 
     if (NOT DEFINED ROCM_TEST_CHIPSET)
-      execute_process(COMMAND "${ROCM_PATH}/bin/rocm_agent_enumerator"
-      OUTPUT_VARIABLE AGENTS_STRING
-      ERROR_VARIABLE AGENTS_STRING
-      RESULT_VARIABLE AGENT_ENUMERATOR_RESULT)
-
+      find_program(ROCM_AGENT_ENUMERATOR rocm_agent_enumerator "${ROCM_PATH}/bin" /usr/bin /usr/local/bin)
+      if(ROCM_AGENT_ENUMERATOR)
+          execute_process(COMMAND "${ROCM_AGENT_ENUMERATOR}"
+          OUTPUT_VARIABLE AGENTS_STRING
+          ERROR_VARIABLE AGENTS_STRING
+          RESULT_VARIABLE AGENT_ENUMERATOR_RESULT)
+      else()
+        message(SEND_ERROR "Could not find rocm_agent_enumerator")
+      endif()
       if (NOT AGENT_ENUMERATOR_RESULT EQUAL 0)
         message(SEND_ERROR "Could not run rocm_agent_enumerator and ROCM_TEST_CHIPSET is not defined")
         set(AGENTS_STRING "")


        


More information about the Mlir-commits mailing list