diff options
author | afzpatel <122491982+afzpatel@users.noreply.github.com> | 2024-11-18 17:09:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-18 14:09:18 -0800 |
commit | 63ea528606d0267fd4ebbd449608ee6f5e08f539 (patch) | |
tree | 89dbba225ddc63925aed630a6c63958cdf6db8d8 | |
parent | 89d2b9553de79f6a8a03e2730ee04d4b63ca7144 (diff) | |
download | spack-63ea528606d0267fd4ebbd449608ee6f5e08f539.tar.gz spack-63ea528606d0267fd4ebbd449608ee6f5e08f539.tar.bz2 spack-63ea528606d0267fd4ebbd449608ee6f5e08f539.tar.xz spack-63ea528606d0267fd4ebbd449608ee6f5e08f539.zip |
mivisionx, migraphx and rocal: add and fix tests (#47453)
* fix mivisionx test, add migraphx build-time test and add rocal unit test
* fix miopen-hip linking issue
* remove setup_run_environment from roctracer-dev
* change patch file
7 files changed, 179 insertions, 62 deletions
diff --git a/var/spack/repos/builtin/packages/migraphx/package.py b/var/spack/repos/builtin/packages/migraphx/package.py index f282fc5293..dfe5d462b9 100644 --- a/var/spack/repos/builtin/packages/migraphx/package.py +++ b/var/spack/repos/builtin/packages/migraphx/package.py @@ -159,6 +159,7 @@ class Migraphx(CMakePackage): "CMAKE_CXX_FLAGS", "-fsanitize=address -shared-libasan -I{0}".format(abspath) ) ) + args.append(self.define("BUILD_TESTING", self.run_tests)) return args def test_unit_tests(self): diff --git a/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.1.0.patch b/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.1.0.patch index c12450b451..e72924fd56 100644 --- a/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.1.0.patch +++ b/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.1.0.patch @@ -1,26 +1,42 @@ -From bbfc08e034b80d8b8c6895cb74c38544ffa9a9b4 Mon Sep 17 00:00:00 2001 -From: sreenivasa murthy kolam <sreenivasamurthy.kolam@amd.com> -Date: Thu, 24 Oct 2024 14:01:27 +0000 +From ea1ff66e448c977da9c5cff74e201850d6b9b04c Mon Sep 17 00:00:00 2001 +From: Afzal Patel <Afzal.Patel@amd.com> +Date: Thu, 7 Nov 2024 22:08:17 +0000 Subject: [PATCH] link with roctracer when building miopendriver for 6.1.0 --- - driver/CMakeLists.txt | 3 +++ - 1 file changed, 3 insertions(+) + driver/CMakeLists.txt | 4 ++++ + src/CMakeLists.txt | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt -index 7d4fdbb..31de1ba 100644 +index 7d4fdbb..9e5ede5 100644 --- a/driver/CMakeLists.txt +++ b/driver/CMakeLists.txt -@@ -34,6 +34,9 @@ endif() +@@ -34,6 +34,10 @@ endif() add_dependencies(MIOpenDriver generate_kernels) target_include_directories(MIOpenDriver PRIVATE ../src/kernels) target_link_libraries(MIOpenDriver MIOpen Threads::Threads) +if(MIOPEN_USE_ROCTRACER) ++ target_include_directories(MIOpenDriver PRIVATE ${ROCTRACER_INCLUDE_DIR}) + target_link_libraries(MIOpenDriver ${rocTracer}) +endif() if(NOT MIOPEN_EMBED_DB STREQUAL "") target_link_libraries(MIOpenDriver $<BUILD_INTERFACE:miopen_data> ) endif() --- -2.39.3 +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 0741a60..47573d4 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -861,7 +861,8 @@ if(NOT WIN32 AND NOT APPLE) + endif() + + if(MIOPEN_USE_ROCTRACER) +- target_link_libraries(MIOpen PRIVATE roctx64) ++ target_include_directories(MIOpen PRIVATE ${ROCTRACER_INCLUDE_DIR}) ++ target_link_libraries(MIOpen PRIVATE ${rocTracer}) + endif() + + ############################################################ +-- +2.43.5 diff --git a/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.2.0.patch b/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.2.0.patch index fd8a3bb88c..2c2c7feda5 100644 --- a/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.2.0.patch +++ b/var/spack/repos/builtin/packages/miopen-hip/0001-link-with-roctracer-when-building-miopendriver-6.2.0.patch @@ -1,26 +1,41 @@ -From 5565f0bf0a8e7b8217ed1a943a4210fec303ec42 Mon Sep 17 00:00:00 2001 -From: sreenivasa murthy kolam <sreenivasamurthy.kolam@amd.com> -Date: Thu, 24 Oct 2024 13:55:01 +0000 +From 3cb81598fd66aab0fa5b0c6aac654a91ed90e872 Mon Sep 17 00:00:00 2001 +From: Afzal Patel <Afzal.Patel@amd.com> +Date: Thu, 7 Nov 2024 21:42:15 +0000 Subject: [PATCH] link with roctracer when building miopendriver --- - driver/CMakeLists.txt | 3 +++ - 1 file changed, 3 insertions(+) + driver/CMakeLists.txt | 4 ++++ + src/CMakeLists.txt | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/driver/CMakeLists.txt b/driver/CMakeLists.txt -index 8f19a90..6c701d6 100644 +index 8f19a90..6d32b83 100644 --- a/driver/CMakeLists.txt +++ b/driver/CMakeLists.txt -@@ -64,6 +64,9 @@ endif() +@@ -64,6 +64,10 @@ endif() add_dependencies(MIOpenDriver generate_kernels) target_include_directories(MIOpenDriver PRIVATE ../src/kernels) target_link_libraries(MIOpenDriver MIOpen Threads::Threads roc::rocrand) +if(MIOPEN_USE_ROCTRACER) ++ target_include_directories(MIOpenDriver PRIVATE ${ROCTRACER_INCLUDE_DIR}) + target_link_libraries(MIOpenDriver ${rocTracer}) +endif() if(NOT MIOPEN_EMBED_DB STREQUAL "") target_link_libraries(MIOpenDriver $<BUILD_INTERFACE:miopen_data> ) endif() --- -2.39.3 +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 66ac75f..69da1b9 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -917,7 +917,8 @@ if(NOT WIN32 AND NOT APPLE) + endif() + + if(MIOPEN_USE_ROCTRACER) +- target_link_libraries(MIOpen PRIVATE roctx64) ++ target_include_directories(MIOpen PRIVATE ${ROCTRACER_INCLUDE_DIR}) ++ target_link_libraries(MIOpen PRIVATE ${rocTracer}) + endif() + ############################################################ +-- +2.43.5 diff --git a/var/spack/repos/builtin/packages/miopen-hip/package.py b/var/spack/repos/builtin/packages/miopen-hip/package.py index c9544379f4..f58acb04dd 100644 --- a/var/spack/repos/builtin/packages/miopen-hip/package.py +++ b/var/spack/repos/builtin/packages/miopen-hip/package.py @@ -208,12 +208,13 @@ class MiopenHip(CMakePackage): args.append("-DROCTRACER_LIB_DIR={0}".format(self.spec["roctracer-dev"].prefix.lib)) args.append("-DSQLITE_INCLUDE_DIR={0}".format(self.spec["sqlite"].prefix.include)) if self.spec.satisfies("@6.1:"): + args.append( + "-DROCTRACER_INCLUDE_DIR={0}".format(self.spec["roctracer-dev"].prefix.include) + ) args.append(self.define("MIOPEN_USE_ROCTRACER", "ON")) args.append( self.define( "CMAKE_CXX_FLAGS", - f"-I{self.spec['roctracer-dev'].prefix.include} " - f"-L{self.spec['roctracer-dev'].prefix.roctracer.lib} " f"-I{self.spec['nlohmann-json'].prefix.include} " f"-I{self.spec['sqlite'].prefix.include} ", ) diff --git a/var/spack/repos/builtin/packages/mivisionx/0002-add-half-include-path-for-tests-6.2.0.patch b/var/spack/repos/builtin/packages/mivisionx/0002-add-half-include-path-for-tests-6.2.0.patch new file mode 100644 index 0000000000..b45580ef0e --- /dev/null +++ b/var/spack/repos/builtin/packages/mivisionx/0002-add-half-include-path-for-tests-6.2.0.patch @@ -0,0 +1,52 @@ +From 19f084566394c6556cacf1b812a9a64e1fe0610e Mon Sep 17 00:00:00 2001 +From: Renjith Ravindran <Renjith.RavindranKannath@amd.com> +Date: Wed, 12 Jun 2024 23:33:53 +0000 +Subject: [PATCH] add half include path for tests in 6.1 + +--- + model_compiler/python/nnir_to_clib.py | 4 ++++ + samples/mv_objdetect/CMakeLists.txt | 6 +++++- + utilities/rocAL/rocAL_unittests/CMakeLists.txt | 3 ++- + utilities/rocAL/rocAL_video_unittests/CMakeLists.txt | 3 ++- + 4 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/model_compiler/python/nnir_to_clib.py b/model_compiler/python/nnir_to_clib.py +index 623bf43..544ed31 100644 +--- a/model_compiler/python/nnir_to_clib.py ++++ b/model_compiler/python/nnir_to_clib.py +@@ -160,6 +160,10 @@ if (OPENVX_BACKEND_OPENCL_FOUND) + include_directories (${OpenCL_INCLUDE_DIRS} ${OpenCL_INCLUDE_DIRS}/Headers ) + endif() + ++find_path(HALF_INCLUDE_DIR half.hpp) ++message(STATUS "HALF_INCLUDE_DIR: ${HALF_INCLUDE_DIR}") ++include_directories(${HALF_INCLUDE_DIR}) ++ + find_package(OpenCV QUIET) + include_directories (${ROCM_PATH}/include ${ROCM_PATH}/include/mivisionx) + include_directories (${PROJECT_SOURCE_DIR}/lib) +diff --git a/samples/mv_objdetect/CMakeLists.txt b/samples/mv_objdetect/CMakeLists.txt +index 54d527b..c334ae4 100644 +--- a/samples/mv_objdetect/CMakeLists.txt ++++ b/samples/mv_objdetect/CMakeLists.txt +@@ -29,6 +29,7 @@ project (mvobjdetect) + set (CMAKE_CXX_STANDARD 14) + + list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) ++find_path(HALF_INCLUDE_DIR half.hpp) + find_package(OpenCV QUIET) + + set(ROCM_PATH /opt/rocm CACHE PATH "ROCm Installation Path") +@@ -50,7 +51,10 @@ if (OPENVX_BACKEND_OPENCL_FOUND) + include_directories (${OpenCL_INCLUDE_DIRS} ${OpenCL_INCLUDE_DIRS}/Headers ) + endif() + +-include_directories (${ROCM_PATH}/include ${ROCM_PATH}/include/mivisionx ${PROJECT_SOURCE_DIR} ) ++find_path(HALF_INCLUDE_DIR half.hpp) ++message(STATUS "HALF_INCLUDE_DIR: ${HALF_INCLUDE_DIR}") ++ ++include_directories (${ROCM_PATH}/include/mivisionx ${PROJECT_SOURCE_DIR} ${HALF_INCLUDE_DIR} ) + link_directories (${ROCM_PATH}/lib ${PROJECT_SOURCE_DIR}/lib) + option (USE_POSTPROC "Use postprocessing module implementation" ON) + set(SOURCES mvobjdetect.cpp mvdeploy_api.cpp visualize.cpp) +2.27.0 diff --git a/var/spack/repos/builtin/packages/mivisionx/package.py b/var/spack/repos/builtin/packages/mivisionx/package.py index 332d9d4ca9..a69f886f53 100644 --- a/var/spack/repos/builtin/packages/mivisionx/package.py +++ b/var/spack/repos/builtin/packages/mivisionx/package.py @@ -64,7 +64,8 @@ class Mivisionx(CMakePackage): patch("0001-add-half-include-path.patch", when="@5.5") patch("0001-add-half-include-path-5.6.patch", when="@5.6:6.1") patch("0002-add-half-include-path-for-tests.patch", when="@5.5:6.0 +add_tests") - patch("0002-add-half-include-path-for-tests-6.1.0.patch", when="@6.1.0: +add_tests") + patch("0002-add-half-include-path-for-tests-6.1.0.patch", when="@6.1 +add_tests") + patch("0002-add-half-include-path-for-tests-6.2.0.patch", when="@6.2.0: +add_tests") patch( "https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/commit/da24882438b91a0ae1feee23206b75c1a1256887.patch?full_index=1", @@ -95,11 +96,6 @@ class Mivisionx(CMakePackage): r"${ROCM_PATH}/llvm/bin/clang++", "{0}/bin/clang++".format(self.spec["llvm-amdgpu"].prefix), "amd_openvx/openvx/hipvx/CMakeLists.txt", - string=True, - ) - filter_file( - r"${ROCM_PATH}/llvm/bin/clang++", - "{0}/bin/clang++".format(self.spec["llvm-amdgpu"].prefix), "amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt", string=True, ) @@ -137,67 +133,43 @@ class Mivisionx(CMakePackage): string=True, ) - if self.spec.satisfies("+add_tests"): + if self.spec.satisfies("@:6.1 +add_tests"): filter_file( - r"${ROCM_PATH}/include/mivisionx", - "{0}/include/mivisionx".format(self.spec.prefix), - "tests/amd_migraphx_tests/mnist/CMakeLists.txt", + r"${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR}/mivisionx/rocal", + "{0}/include/mivisionx/rocal".format(self.spec.prefix), + "utilities/rocAL/rocAL_unittests/CMakeLists.txt", + "utilities/rocAL/rocAL_video_unittests/CMakeLists.txt", string=True, ) filter_file( r"${ROCM_PATH}/lib", "{0}/lib".format(self.spec.prefix), - "tests/amd_migraphx_tests/mnist/CMakeLists.txt", + "utilities/rocAL/rocAL_unittests/CMakeLists.txt", + "utilities/rocAL/rocAL_video_unittests/CMakeLists.txt", string=True, ) + if self.spec.satisfies("+add_tests"): filter_file( r"${ROCM_PATH}/include/mivisionx", "{0}/include/mivisionx".format(self.spec.prefix), + "tests/amd_migraphx_tests/mnist/CMakeLists.txt", "tests/amd_migraphx_tests/resnet50/CMakeLists.txt", + "model_compiler/python/nnir_to_clib.py", string=True, ) filter_file( r"${ROCM_PATH}/lib", "{0}/lib".format(self.spec.prefix), + "tests/amd_migraphx_tests/mnist/CMakeLists.txt", "tests/amd_migraphx_tests/resnet50/CMakeLists.txt", string=True, ) filter_file( - r"${ROCM_PATH}/include/mivisionx", - "{0}/include/mivisionx".format(self.spec.prefix), - "model_compiler/python/nnir_to_clib.py", - string=True, - ) - filter_file( r"/opt/rocm", "{0}".format(self.spec.prefix), "model_compiler/python/nnir_to_clib.py", string=True, ) - filter_file( - r"${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR}/mivisionx/rocal", - "{0}/include/mivisionx/rocal".format(self.spec.prefix), - "utilities/rocAL/rocAL_unittests/CMakeLists.txt", - string=True, - ) - filter_file( - r"${ROCM_PATH}/lib", - "{0}/lib".format(self.spec.prefix), - "utilities/rocAL/rocAL_unittests/CMakeLists.txt", - string=True, - ) - filter_file( - r"${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR}/mivisionx/rocal", - "{0}/include/mivisionx/rocal".format(self.spec.prefix), - "utilities/rocAL/rocAL_video_unittests/CMakeLists.txt", - string=True, - ) - filter_file( - r"${ROCM_PATH}/lib", - "{0}/lib".format(self.spec.prefix), - "utilities/rocAL/rocAL_video_unittests/CMakeLists.txt", - string=True, - ) depends_on("cmake@3.5:", type="build") depends_on("ffmpeg@:4", type="build", when="@:5.3") @@ -337,12 +309,13 @@ class Mivisionx(CMakePackage): args.append( self.define("AMDRPP_INCLUDE_DIRS", "{0}/include/rpp".format(spec["rpp"].prefix)) ) + args.append(self.define("CMAKE_INSTALL_PREFIX_PYTHON", spec.prefix)) + if self.spec.satisfies("@5.5:6.2.0"): args.append( self.define( "TurboJpeg_LIBRARIES_DIRS", "{0}/lib64".format(spec["libjpeg-turbo"].prefix) ) ) - args.append(self.define("CMAKE_INSTALL_PREFIX_PYTHON", spec.prefix)) return args @run_after("install") diff --git a/var/spack/repos/builtin/packages/rocal/package.py b/var/spack/repos/builtin/packages/rocal/package.py index c9196dd562..30902117ed 100644 --- a/var/spack/repos/builtin/packages/rocal/package.py +++ b/var/spack/repos/builtin/packages/rocal/package.py @@ -37,6 +37,56 @@ class Rocal(CMakePackage): "rocAL/rocAL_hip/CMakeLists.txt", string=True, ) + filter_file( + r"${ROCM_PATH}/include/rocal", + "{0}/include/rocal".format(self.spec.prefix), + "tests/cpp_api/CMakeLists.txt", + string=True, + ) + filter_file( + r"${ROCM_PATH}/${CMAKE_INSTALL_INCLUDEDIR}/rocal", + "{0}/include/rocal".format(self.spec.prefix), + "tests/cpp_api/audio_tests/CMakeLists.txt", + "tests/cpp_api/image_augmentation/CMakeLists.txt", + "tests/cpp_api/basic_test/CMakeLists.txt", + "tests/cpp_api/performance_tests/CMakeLists.txt", + "tests/cpp_api/dataloader/CMakeLists.txt", + "tests/cpp_api/performance_tests_with_depth/CMakeLists.txt", + "tests/cpp_api/dataloader_multithread/CMakeLists.txt", + "tests/cpp_api/unit_tests/CMakeLists.txt", + "tests/cpp_api/dataloader_tf/CMakeLists.txt", + "tests/cpp_api/video_tests/CMakeLists.txt", + "tests/cpp_api/external_source/CMakeLists.txt", + string=True, + ) + filter_file( + r"${ROCM_PATH}/lib", + "{0}/lib".format(self.spec.prefix), + "tests/cpp_api/audio_tests/CMakeLists.txt", + "tests/cpp_api/image_augmentation/CMakeLists.txt", + "tests/cpp_api/basic_test/CMakeLists.txt", + "tests/cpp_api/performance_tests/CMakeLists.txt", + "tests/cpp_api/dataloader/CMakeLists.txt", + "tests/cpp_api/performance_tests_with_depth/CMakeLists.txt", + "tests/cpp_api/dataloader_multithread/CMakeLists.txt", + "tests/cpp_api/unit_tests/CMakeLists.txt", + "tests/cpp_api/dataloader_tf/CMakeLists.txt", + "tests/cpp_api/video_tests/CMakeLists.txt", + "tests/cpp_api/external_source/CMakeLists.txt", + string=True, + ) + filter_file( + r"${ROCM_PATH}/lib", + "{0}/lib".format(self.spec.prefix), + "tests/cpp_api/CMakeLists.txt", + string=True, + ) + filter_file( + r"${ROCM_PATH}/share/rocal", + "{0}/share/rocal".format(self.spec.prefix), + "tests/cpp_api/CMakeLists.txt", + string=True, + ) def cmake_args(self): args = [ @@ -46,3 +96,12 @@ class Rocal(CMakePackage): self.define("CMAKE_INSTALL_PREFIX_PYTHON", self.spec.prefix), ] return args + + def check(self): + print("test will run after install") + + @run_after("install") + @on_package_attributes(run_tests=True) + def check_install(self): + with working_dir(self.build_directory, create=True): + make("test") |