Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding HostLibraryTests back to hipBLASLt #1147

Open
wants to merge 51 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
848b6f6
Add tuning parameters with updated doc comments
AlexBrownAMD Jun 4, 2024
6ff49e1
SK Port: (Host) Debug settings and Grid Selector (#1)
bethune-bryant Jun 5, 2024
c85586d
Merge branch 'ROCm:develop' into StreamK
bethune-bryant Jun 6, 2024
f25ba0b
Stream-K kernel arguments, metadata, and launch grid code
AlexBrownAMD Jun 6, 2024
1e19915
Increase default max workspace for tensile tuning client
AlexBrownAMD Jun 6, 2024
223aedc
Increase default workspace for bench client (#2)
bethune-bryant Jun 6, 2024
e1e38a7
Merge branch 'ROCm:develop' into StreamK
bethune-bryant Jun 7, 2024
d0d4bc3
Merge remote-tracking branch 'origin' into StreamK
AlexBrownAMD Jun 12, 2024
e9a56b0
Merge remote-tracking branch 'origin/StreamK' into StreamK
AlexBrownAMD Jun 21, 2024
7809986
Update gitignore
AlexBrownAMD Jun 21, 2024
cbf4ef3
Option to disable GSU in kernels.
AlexBrownAMD Jun 21, 2024
b92f313
UpdatedSolutionStructs, reject cases and golbal accumulation code
AlexBrownAMD Jun 24, 2024
ca5221d
Stream-k code gen work in progress
AlexBrownAMD Jun 26, 2024
8f5a915
Some bug fixes and more work on persistent loop
AlexBrownAMD Jun 26, 2024
0d5cec7
Store branches and close persistent loop
AlexBrownAMD Jun 28, 2024
2296748
Add code for workspace SRD, working on partials write, some updates/f…
AlexBrownAMD Jul 2, 2024
ac84fa9
Support for predicate arithmetic intensity added on top of streamK br…
adityalj Jul 15, 2024
259f6b4
Write partials and some bug fixes
AlexBrownAMD Jul 16, 2024
a100b1f
Grid prediction (#4)
adityalj Jul 22, 2024
5ce3017
Fixup/partials, flag init, bug fixes
AlexBrownAMD Jul 22, 2024
6a50f3d
Enable sk grid and fix tile calculation
AlexBrownAMD Jul 22, 2024
4df66e5
Merge branch 'StreamK' into StreamKGen
AlexBrownAMD Jul 22, 2024
fc0f23d
Merge pull request #6 from AlexBrownAMD/StreamKGen
AlexBrownAMD Jul 23, 2024
16fa505
Some build fixes
AlexBrownAMD Jul 23, 2024
9e8fa21
Fix race condition on flag reset
AlexBrownAMD Jul 23, 2024
5642e5c
Flag point to input synchronizer
adityalj Jul 23, 2024
2f882d6
point flag to synchronizer
adityalj Jul 24, 2024
0c5159d
remove space allocated for flags
adityalj Jul 24, 2024
445e1f1
Some bug fixes, general case sgemm tests passing
AlexBrownAMD Jul 31, 2024
8367400
Merge pull request #7 from adityalj/flag_init
AlexBrownAMD Aug 12, 2024
f734836
SOme bug fixes
AlexBrownAMD Aug 16, 2024
dca3d24
Merge remote-tracking branch 'upstream/develop' into StreamKMerge
AlexBrownAMD Aug 19, 2024
593e98f
Merge fixes for stream-k
AlexBrownAMD Aug 21, 2024
3a96ecf
Some stream-k test files
AlexBrownAMD Aug 21, 2024
2c7b462
Merge remote-tracking branch 'upstream/develop' into StreamKMerge2
AlexBrownAMD Aug 21, 2024
7b84b91
Bug fixes from merge
AlexBrownAMD Aug 22, 2024
cfdaf49
Update targets for new tests
AlexBrownAMD Aug 23, 2024
44f2d35
Remove duplicate code and addreject for unsupported config
AlexBrownAMD Aug 23, 2024
e7d7d57
If stream-k enabled, force GSU=0
AlexBrownAMD Aug 23, 2024
bfbfde1
Bug fixes for SKXCCM and SK=2
AlexBrownAMD Aug 28, 2024
e6de95f
Fix race condition when resetting synchronizer flags
AlexBrownAMD Sep 6, 2024
fc61d87
Disable LRA backup, not needed for stream-k, and not compatible with …
AlexBrownAMD Sep 6, 2024
e304cf7
Small optimization from PR review
AlexBrownAMD Sep 6, 2024
256da9b
Add new test case based on race condition
AlexBrownAMD Sep 6, 2024
3bbeff9
Merge remote-tracking branch 'upstream/develop' into StreamKMerge2
AlexBrownAMD Sep 6, 2024
21abe72
Fix merge issue
AlexBrownAMD Sep 6, 2024
f9e6622
initial PR requirements
Sep 19, 2024
79c6cc7
Update README.md to add HostLibraryTests
mahmoodw Sep 19, 2024
2f9f0ac
Merge branch 'develop' of github.com:ROCm/hipBLASLt into addHostLibra…
Sep 19, 2024
0ae40e8
Merge branch 'addHostLibraryTestInit' of github.com:mahmoodw/hipBLASL…
Sep 19, 2024
3669450
Clean up
Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tensilelite/HostLibraryTests/googletest"]
path = tensilelite/HostLibraryTests/googletest
url = https://github.com/google/googletest.git
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ You can find more information at the following links:
* [hipblaslt-test](clients/gtest/README.md)
* [hipblaslt-bench](clients/benchmarks/README.md)

## Host Library Tests
Host Library Tests can be built and ran using the following commands:
``` git submodule init
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc -DCODE_OBJECT_VERSION=default -DTensile_ROOT=$(pwd)/../Tensile ../HostLibraryTests
make -j
./TensileTests
```

## Contribute

If you want to submit an issue, you can do so on
Expand Down
181 changes: 181 additions & 0 deletions tensilelite/HostLibraryTests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
################################################################################
#
# Copyright (C) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
################################################################################

cmake_minimum_required(VERSION 3.13)

project(TensileHostLibraryTest)

set( CMAKE_CXX_STANDARD 17 )
set( CMAKE_CXX_EXTENSIONS OFF )

list(APPEND CMAKE_PREFIX_PATH $ENV{ROCM_PATH} /opt/rocm)

option(TENSILE_USE_HIP "Use the Hip runtime." ON)
option(TENSILE_USE_OPENCL "Use the OpenCL runtime." OFF)
option(TENSILE_USE_LLVM "Use LLVM for parsing config files." ON)
option(TENSILE_USE_MSGPACK "Use msgpack for parsing config files." ON)
option(TENSILE_USE_OPENMP "Enable OpenMP multithreading." ON)
option(TENSILE_STATIC_ONLY "Disable exposing Tensile symbols in a shared library." ON)
option(TENSILE_DISABLE_CTEST "Disable CTest integration." ON)

if(TENSILE_USE_HIP)
set(TENSILE_COMPONENTS HIP)
if(TENSILE_USE_LLVM)
set(TENSILE_COMPONENTS ${TENSILE_COMPONENTS} Client)
endif()
endif()
if(TENSILE_USE_OPENCL)
set(TENSILE_COMPONENTS ${TENSILE_COMPONENTS} OpenCL)
endif()
if(TENSILE_USE_LLVM)
set(TENSILE_COMPONENTS ${TENSILE_COMPONENTS} LLVM)
endif()
if(TENSILE_USE_OPENMP)
set(TENSILE_COMPONENTS ${TENSILE_COMPONENTS} OpenMP)
endif()
if(TENSILE_STATIC_ONLY)
set(TENSILE_COMPONENTS ${TENSILE_COMPONENTS} STATIC_ONLY)
endif()

if(NOT Tensile_FOUND)
find_package(Tensile 4.33.0 EXACT REQUIRED ${TENSILE_COMPONENTS} PATHS "${CMAKE_CURRENT_SOURCE_DIR}/../Tensile")
endif()

if(NOT TENSILE_DISABLE_CTEST)
enable_testing()

if(CMAKE_VERSION VERSION_GREATER 3.9)
include(GoogleTest)
option(GTEST_INTEGRATION "Enable Googletest integration with CMake." ON)
else()
option(GTEST_INTEGRATION "Enable Googletest integration with CMake." OFF)
endif()
endif()

set(INSTALL_GTEST OFF CACHE BOOL "Install GTest")
add_subdirectory(googletest)
if(NOT gtest_SOURCE_DIR)
message(FATAL_ERROR "googletest not found. Run git submodule update --init")
endif()

find_package(Boost COMPONENTS filesystem)

#if(TENSILE_USE_HIP AND NOT HIP_DIR)
if(TENSILE_USE_HIP)
find_package(HIP REQUIRED CONFIG PATHS $ENV{ROCM_PATH} /opt/rocm)
endif()

if(TENSILE_USE_OPENMP AND NOT TARGET custom_openmp_cxx)

# Workaround for https://gitlab.kitware.com/cmake/cmake/-/issues/21787
# ensures we link to HIP's libomp and get an rpath to it.
add_library(custom_openmp_cxx INTERFACE)

if(TENSILE_USE_HIP)
target_compile_options(custom_openmp_cxx INTERFACE "-fopenmp")
target_link_options(custom_openmp_cxx INTERFACE "-fopenmp")
else ()
find_package(OpenMP REQUIRED)
target_link_libraries(custom_openmp_cxx INTERFACE OpenMP::OpenMP_CXX)
endif ()
endif()

if(TENSILE_USE_OPENCL)
find_package(OpenCL REQUIRED)
endif()

add_subdirectory(configs)

set(TEST_DATA_DIR "${CMAKE_CURRENT_BINARY_DIR}/data")
file(MAKE_DIRECTORY "${TEST_DATA_DIR}")

foreach(FILE ${SOLUTION_LIBRARY_FILES})
if(EXISTS ${FILE})
endif()
execute_process(COMMAND gzip --keep --decompress --force "${FILE}.gz")
file(COPY ${FILE} DESTINATION "${TEST_DATA_DIR}")
endforeach(FILE)

include_directories("." ${GTEST_SOURCE_DIR}/include)
add_subdirectory(testlib)

set(test_sources ${test_sources}
test.cpp
ContractionSelectionLibrary_test.cpp
DataTypes_test.cpp
Predicates_test.cpp
)

if(TENSILE_USE_LLVM)
find_package(LLVM REQUIRED CONFIG)

set(test_sources ${test_sources}
llvm/LibraryPerformance_test.cpp
)
endif()

# if(TENSILE_USE_HIP)
# add_subdirectory(hip)
# endif()

add_executable(TensileTests ${test_sources})

if(NOT TENSILE_DISABLE_CTEST)
if(GTEST_INTEGRATION)
gtest_discover_tests(TensileTests WORKING_DIRECTORY ${CMAKE_BINARY_DIR} TIMEOUT 60)
else()
add_test(NAME TensileHostLibraryTests COMMAND TensileTests WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endif()
endif()

target_link_libraries(TensileTests PUBLIC gtest TensileHost TensileTestLib ${Boost_LIBRARIES})

if(TENSILE_USE_LLVM)
find_library(LLVMObjectYAML_LIBRARY
NAMES LLVMObjectYAML
PATHS ${LLVM_LIBRARY_DIR})
message("LLVMObjectYAML_LIBRARY: ${LLVMObjectYAML_LIBRARY}")
#Use LLVM shared libs if LLVMObjectYAML static lib cannot be found
if(LLVMObjectYAML_LIBRARY)
target_link_libraries(TensileTests PUBLIC LLVMObjectYAML )
else()
target_link_libraries(TensileTests PUBLIC LLVM )
endif()
target_include_directories(TensileTests PUBLIC ${LLVM_INCLUDE_DIRS})
endif()

if(TENSILE_USE_HIP)

target_link_libraries(TensileTests PRIVATE "-Xlinker --whole-archive")
target_link_libraries(TensileTests PUBLIC ${HIP_TEST_LIBRARIES})
target_link_libraries(TensileTests PRIVATE "-Xlinker --no-whole-archive")
foreach(arch IN LISTS TENSILE_GPU_ARCHS)
target_link_libraries(TensileTests PRIVATE "--offload-arch=${arch}")
endforeach(arch)
endif()

if(TENSILE_USE_OPENMP)
target_link_libraries(TensileTests PRIVATE custom_openmp_cxx)
endif()

Loading