From 433a3cb2c49de17b518eb32fcf48cd6c8fa9e619 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Thu, 20 Jun 2024 20:40:01 +0000 Subject: [PATCH 1/3] Small update to output messages Signed-off-by: David Galiffi --- HIP-Basic/assembly_to_executable/CMakeLists.txt | 5 ++++- HIP-Basic/llvm_ir_to_executable/CMakeLists.txt | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/HIP-Basic/assembly_to_executable/CMakeLists.txt b/HIP-Basic/assembly_to_executable/CMakeLists.txt index 741627349..df644289e 100644 --- a/HIP-Basic/assembly_to_executable/CMakeLists.txt +++ b/HIP-Basic/assembly_to_executable/CMakeLists.txt @@ -77,7 +77,10 @@ endif() # Remove duplicates. list(REMOVE_DUPLICATES GPU_ARCHITECTURES) -message(STATUS "GPU_ARCHITECTURES: ${GPU_ARCHITECTURES}") +message( + STATUS + "assembly_to_executable - GPU_ARCHITECTURES: ${GPU_ARCHITECTURES}" +) set_source_files_properties( main.hip diff --git a/HIP-Basic/llvm_ir_to_executable/CMakeLists.txt b/HIP-Basic/llvm_ir_to_executable/CMakeLists.txt index 25b32762b..aead6f9c1 100644 --- a/HIP-Basic/llvm_ir_to_executable/CMakeLists.txt +++ b/HIP-Basic/llvm_ir_to_executable/CMakeLists.txt @@ -77,7 +77,10 @@ endif() # Remove duplicates list(REMOVE_DUPLICATES GPU_ARCHITECTURES) -message(STATUS "GPU_ARCHITECTURES: ${GPU_ARCHITECTURES}") +message( + STATUS + "llvm_ir_to_executable - GPU_ARCHITECTURES: ${GPU_ARCHITECTURES}" +) set_source_files_properties( main.hip From 739f80375c178dcd75e8c99755f48f05077ddaf3 Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Thu, 20 Jun 2024 21:43:53 +0000 Subject: [PATCH 2/3] Skip texture_management example on unsupporting hardware Update CMakeList to still this example on gfx94*. Signed-off-by: David Galiffi --- HIP-Basic/CMakeLists.txt | 14 ++++++- HIP-Basic/texture_management/CMakeLists.txt | 45 +++++++++++++-------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/HIP-Basic/CMakeLists.txt b/HIP-Basic/CMakeLists.txt index 5ba678e40..af9f4ad9b 100644 --- a/HIP-Basic/CMakeLists.txt +++ b/HIP-Basic/CMakeLists.txt @@ -127,7 +127,19 @@ if(NOT WIN32 AND NOT "${GPU_RUNTIME}" STREQUAL "HIP") add_subdirectory(static_host_library) endif() add_subdirectory(streams) -add_subdirectory(texture_management) + +# This example is not supported on gfx940, gfx941, and gfx942 +# See: __HIP_NO_IMAGE_SUPPORT in hip/amd_detail/amd_device_functions.h +list(REMOVE_DUPLICATES CMAKE_HIP_ARCHITECTURES) +if(NOT (CMAKE_HIP_ARCHITECTURES MATCHES "gfx94*")) + add_subdirectory(texture_management) +else() + message( + WARNING + "SKIP: Texture management example not supported on gfx940, gfx941, and gfx942" + ) +endif() + add_subdirectory(warp_shuffle) find_package(glfw3) diff --git a/HIP-Basic/texture_management/CMakeLists.txt b/HIP-Basic/texture_management/CMakeLists.txt index e9f2f5678..5a31e73ae 100644 --- a/HIP-Basic/texture_management/CMakeLists.txt +++ b/HIP-Basic/texture_management/CMakeLists.txt @@ -57,23 +57,36 @@ endif() list(APPEND CMAKE_PREFIX_PATH "${ROCM_ROOT}") -add_executable(${example_name} main.hip) -# Make example runnable using ctest -add_test(${example_name} ${example_name}) - -# Temporary workaround: a known bug prevents the example from executing succesfully -# if multiple GPUs are visible -set_tests_properties( - ${example_name} - PROPERTIES ENVIRONMENT "HIP_VISIBLE_DEVICES=0" +# Check if GPU architecture is supported +list(REMOVE_DUPLICATES CMAKE_HIP_ARCHITECTURES) +message( + STATUS + "texture_management - CMAKE_HIP_ARCHITECTURES: ${CMAKE_HIP_ARCHITECTURES}" ) -set(include_dirs "../../Common") -if(GPU_RUNTIME STREQUAL "CUDA") - list(APPEND include_dirs "${ROCM_ROOT}/include") -endif() +if(NOT CMAKE_HIP_ARCHITECTURES MATCHES "gfx94*") + add_executable(${example_name} main.hip) + + # Make example runnable using ctest + add_test(${example_name} ${example_name}) + + # Temporary workaround: a known bug prevents the example from executing succesfully + # if multiple GPUs are visible + set_tests_properties( + ${example_name} + PROPERTIES ENVIRONMENT "HIP_VISIBLE_DEVICES=0" + ) + + set(include_dirs "../../Common") + if(GPU_RUNTIME STREQUAL "CUDA") + list(APPEND include_dirs "${ROCM_ROOT}/include") + endif() -target_include_directories(${example_name} PRIVATE ${include_dirs}) -set_source_files_properties(main.hip PROPERTIES LANGUAGE ${GPU_RUNTIME}) + target_include_directories(${example_name} PRIVATE ${include_dirs}) + set_source_files_properties(main.hip PROPERTIES LANGUAGE ${GPU_RUNTIME}) -install(TARGETS ${example_name}) + install(TARGETS ${example_name}) +else() + # As per hip/amd_detail/amd_device_function.h + message(WARNING "This example is not supported on gfx94*, skipping...") +endif() From c33b6c08d1ed7e70b9324d95854336847106d61c Mon Sep 17 00:00:00 2001 From: David Galiffi Date: Tue, 2 Jul 2024 13:18:47 -0400 Subject: [PATCH 3/3] Update warning message. Co-authored-by: Beatriz Navidad Vilches <61422851+Beanavil@users.noreply.github.com> --- HIP-Basic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HIP-Basic/CMakeLists.txt b/HIP-Basic/CMakeLists.txt index af9f4ad9b..fe23699f1 100644 --- a/HIP-Basic/CMakeLists.txt +++ b/HIP-Basic/CMakeLists.txt @@ -136,7 +136,7 @@ if(NOT (CMAKE_HIP_ARCHITECTURES MATCHES "gfx94*")) else() message( WARNING - "SKIP: Texture management example not supported on gfx940, gfx941, and gfx942" + "Texture functions not supported on gfx94*, not building texture management example" ) endif()