Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2c2e494
Add support for gfx1201 on Windows
amd-mtrifuno Nov 28, 2024
73e19e4
Fix ROCM PATH in cmake file
amd-mtrifuno Dec 13, 2024
e20ab2a
Edit CMakeLists.txt files and delete comments
amd-mtrifuno Jan 23, 2025
95381c1
Fix clang path
amd-mtrifuno Jan 23, 2025
dd31352
Add check for windows specific code
amd-mtrifuno Jan 24, 2025
add16f4
Fix error in CMakeLists.txt
amd-mtrifuno Jan 29, 2025
0993192
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Jan 29, 2025
6144d76
Delete comments
amd-mtrifuno Jan 29, 2025
4c318d4
Fix clang path
amd-mtrifuno Jan 30, 2025
b56639a
Edit rtest.py script
amd-mtrifuno Jan 31, 2025
7677573
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Feb 3, 2025
4bc8734
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Feb 6, 2025
aa7f02d
Fix ssize_t in Windows case
amd-mtrifuno Feb 6, 2025
ce4b66a
Add extension for hipconfig on Windows
amd-mtrifuno Feb 6, 2025
d945f8d
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Feb 10, 2025
b9d06b3
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Feb 12, 2025
70f13a9
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Feb 13, 2025
5fb37df
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Feb 14, 2025
0d3001f
Fix hipcc version print on Windows
amd-mtrifuno Feb 14, 2025
8071a17
Change namespace of ClockType enum
amd-mtrifuno Feb 18, 2025
8a5c0e3
Fix library install path
amd-mtrifuno Feb 24, 2025
7bc2658
Fix tox tests on gfx942
amd-mtrifuno Feb 25, 2025
3173b90
Remove split of client library script args
amd-mtrifuno Feb 27, 2025
0c0a52c
Fix args of client library script
amd-mtrifuno Mar 6, 2025
1259c68
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Mar 18, 2025
acc4f60
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Mar 26, 2025
1623b50
Merge branch 'develop' into windows_gfx1201
amd-mtrifuno Mar 27, 2025
49a7d20
Remove castT in linux case
amd-mtrifuno Mar 28, 2025
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
55 changes: 47 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ else()
endif()

if (NOT DEFINED ENV{CXX} AND NOT CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "${rocm_bin}/amdclang++")
if(WIN32)
set(CMAKE_CXX_COMPILER "${rocm_bin}/clang++.exe")
else()
set(CMAKE_CXX_COMPILER "${rocm_bin}/amdclang++")
endif()
endif()

if (NOT DEFINED ENV{CC} AND NOT CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "${rocm_bin}/amdclang")
if(WIN32)
set(CMAKE_C_COMPILER "${rocm_bin}/clang")
else()
set(CMAKE_C_COMPILER "${rocm_bin}/amdclang")
endif()
endif()

# TODO: move FC and CXX and CC compiler vars above to new toolchain-linux.cmake (Fortran for clients)
Expand Down Expand Up @@ -116,7 +124,11 @@ option(Tensile_SEPARATE_ARCHITECTURES "Tensile to use GPU architecture specific
option(Tensile_NO_LAZY_LIBRARY_LOADING "Diasble loading kernels on demand?" OFF)
# For roctx
include(CMakeDependentOption)
cmake_dependent_option(HIPBLASLT_ENABLE_MARKER "Enable roctx marker in hipBLASLt" ON "BUILD_SHARED_LIBS" OFF)
if(WIN32)
cmake_dependent_option(HIPBLASLT_ENABLE_MARKER "Disable roctx marker in hipBLASLt - roctracer does not support on Windows" OFF "BUILD_SHARED_LIBS" OFF)
else()
cmake_dependent_option(HIPBLASLT_ENABLE_MARKER "Enable roctx marker in hipBLASLt" ON "BUILD_SHARED_LIBS" OFF)
endif()

if(BUILD_CODE_COVERAGE)
add_compile_options(-fprofile-arcs -ftest-coverage)
Expand Down Expand Up @@ -195,7 +207,11 @@ else()

set( Tensile_LOGIC "asm_full" CACHE STRING "Tensile to use which logic?")
set( Tensile_CODE_OBJECT_VERSION "4" CACHE STRING "Tensile code_object_version")
set( Tensile_COMPILER "amdclang++" CACHE STRING "Tensile compiler")
if(WIN32)
set( Tensile_COMPILER "clang++.exe" CACHE STRING "Tensile compiler")
else()
set( Tensile_COMPILER "amdclang++" CACHE STRING "Tensile compiler")
endif()
set( Tensile_LIBRARY_FORMAT "msgpack" CACHE STRING "Tensile library format")
set( Tensile_CPU_THREADS "" CACHE STRING "Number of threads for Tensile parallel build")

Expand Down Expand Up @@ -255,9 +271,17 @@ else()
endif()

if( LEGACY_HIPBLAS_DIRECT )
find_package( hipblas REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm)
if (NOT WIN32)
find_package( hipblas REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm)
else()
find_package( hipblas REQUIRED CONFIG PATHS ${HIP_DIR})
endif()
else()
find_package( hipblas-common REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm)
if (NOT WIN32)
find_package( hipblas-common REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm)
else()
find_package( hipblas-common REQUIRED CONFIG PATHS ${HIP_DIR})
endif()
endif()

if(HIPBLASLT_ENABLE_MARKER)
Expand Down Expand Up @@ -359,12 +383,27 @@ if(BUILD_DOCS)
add_subdirectory(docs)
endif()

# The following code is setting variables to control the behavior of CPack to generate our
if( WIN32 )
set( CPACK_SOURCE_GENERATOR "ZIP" )
set( CPACK_GENERATOR "ZIP" )
endif( )

# Package specific CPACK vars
set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md" )
set( CPACK_RPM_PACKAGE_LICENSE "MIT")

if( NOT CPACK_PACKAGING_INSTALL_PREFIX )
set( CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
if (WIN32)
SET( CMAKE_INSTALL_PREFIX "C:/hipSDK" CACHE PATH "Install path" FORCE )
SET( INSTALL_PREFIX "C:/hipSDK" )
SET( CPACK_SET_DESTDIR FALSE )
SET( CPACK_PACKAGE_INSTALL_DIRECTORY "C:/hipSDK" )
SET( CPACK_PACKAGING_INSTALL_PREFIX "" )
set( CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF )
else()
if( NOT CPACK_PACKAGING_INSTALL_PREFIX )
set( CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
endif()
endif()

set( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "\${CPACK_PACKAGING_INSTALL_PREFIX}" "\${CPACK_PACKAGING_INSTALL_PREFIX}/include" "\${CPACK_PACKAGING_INSTALL_PREFIX}/lib" )
Expand Down
30 changes: 23 additions & 7 deletions clients/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ find_package(OpenMP)

if (TARGET OpenMP::OpenMP_CXX)
set( COMMON_LINK_LIBS "OpenMP::OpenMP_CXX")
list( APPEND COMMON_LINK_LIBS "-L${HIP_CLANG_ROOT}/lib;-Wl,-rpath=${HIP_CLANG_ROOT}/lib")
list( APPEND COMMON_LINK_LIBS "-L\"${HIP_CLANG_ROOT}/lib\"")
if (NOT WIN32)
list( APPEND COMMON_LINK_LIBS "-Wl,-rpath=${HIP_CLANG_ROOT}/lib")
endif()
endif()

if (TARGET Threads::Threads)
Expand Down Expand Up @@ -87,12 +90,25 @@ endif( )
if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS)

# Linking lapack library requires fortran flags
find_package( cblas REQUIRED CONFIG )
if(${BLIS_FOUND})
set( BLAS_LIBRARY ${BLIS_LIB} )
set( BLIS_CPP ../common/blis_interface.cpp )
else()
set( BLAS_LIBRARY "blas" )
if ( NOT WIN32 )
find_package( cblas REQUIRED CONFIG )
if(${BLIS_FOUND})
set( BLAS_LIBRARY ${BLIS_LIB} )
set( BLIS_CPP ../common/blis_interface.cpp )
else()
set( BLAS_LIBRARY "blas" )
endif()
else() #WIN32
set( BLAS_INCLUDE_DIR ${OPENBLAS_DIR}/include CACHE PATH "OpenBLAS library include path" )
find_library( BLAS_LIBRARY libopenblas
PATHS ${OPENBLAS_DIR}/lib
NO_DEFAULT_PATH
)
if (NOT BLAS_LIBRARY)
find_package( OPENBLAS CONFIG REQUIRED )
set( BLAS_LIBRARY OpenBLAS::OpenBLAS )
set( BLAS_INCLUDE_DIR "" )
endif()
endif()

# Find the package ROCmSMI
Expand Down
3 changes: 3 additions & 0 deletions clients/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ if (NOT WIN32)
list( APPEND COMMON_LINK_LIBS "-lflang -lflangrti") # for lapack
endif()
else()
find_package(lapack REQUIRED)
message("LAPACK: ${LAPACK_LIBRARIES}")
target_link_libraries(hipblaslt-bench PRIVATE ${LAPACK_LIBRARIES})
list( APPEND COMMON_LINK_LIBS "libomp")
endif()
target_link_libraries( hipblaslt-bench PRIVATE ${COMMON_LINK_LIBS} )
Expand Down
2 changes: 1 addition & 1 deletion clients/common/blis_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

void setup_blis()
{
#ifndef WIN32
#ifndef _WIN32
bli_init();
#endif
}
Expand Down
18 changes: 9 additions & 9 deletions clients/common/hipblaslt_init_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ __device__ int8_t random_hpl(size_t idx)
}

template <typename T>
void hipblaslt_init_device(ABC abc,
void hipblaslt_init_device(ABC_dims abc,
hipblaslt_initialization init,
bool is_nan,
T* A,
Expand All @@ -140,11 +140,11 @@ void hipblaslt_init_device(ABC abc,
switch(init)
{
case hipblaslt_initialization::rand_int:
if(abc == ABC::A || abc == ABC::C)
if(abc == ABC_dims::A || abc == ABC_dims::C)
fill_batch(A, M, N, lda, stride, batch_count, [](size_t idx) -> T {
return random_int<T>(idx);
});
else if(abc == ABC::B)
else if(abc == ABC_dims::B)
{
stride = std::max(lda * N, stride);
fill_batch(A, M, N, lda, stride, batch_count, [stride, lda](size_t idx) -> T {
Expand All @@ -158,14 +158,14 @@ void hipblaslt_init_device(ABC abc,
break;
case hipblaslt_initialization::trig_float:
stride = std::max(lda * N, stride);
if(abc == ABC::A || abc == ABC::C)
if(abc == ABC_dims::A || abc == ABC_dims::C)
fill_batch(A, M, N, lda, stride, batch_count, [M, N, stride, lda](size_t idx) -> T {
auto b = idx / stride;
auto j = (idx - b * stride) / lda;
auto i = (idx - b * stride) - j * lda;
return T(sin(double(i + j*M + b*M*N)));
});
else if(abc == ABC::B)
else if(abc == ABC_dims::B)
fill_batch(A, M, N, lda, stride, batch_count, [M, N, stride, lda](size_t idx) -> T {
auto b = idx / stride;
auto j = (idx - b * stride) / lda;
Expand All @@ -179,15 +179,15 @@ void hipblaslt_init_device(ABC abc,
});
break;
case hipblaslt_initialization::special:
if(abc == ABC::A)
if(abc == ABC_dims::A)
fill_batch(A, M, N, lda, stride, batch_count, [](size_t idx) -> T {
return T(hipblasLtHalf(65280.0));
});
else if(abc == ABC::B)
else if(abc == ABC_dims::B)
fill_batch(A, M, N, lda, stride, batch_count, [](size_t idx) -> T {
return T(hipblasLtHalf(0.0000607967376708984375));
});
else if(abc == ABC::C)
else if(abc == ABC_dims::C)
fill_batch(A, M, N, lda, stride, batch_count, [](size_t idx) -> T {
return T(pseudo_random_device(idx) % 10 + 1.f);
});
Expand All @@ -213,7 +213,7 @@ void hipblaslt_init_device(ABC abc,
}
}

void hipblaslt_init_device(ABC abc,
void hipblaslt_init_device(ABC_dims abc,
hipblaslt_initialization init,
bool is_nan,
void* A,
Expand Down
2 changes: 1 addition & 1 deletion clients/common/hipblaslt_parse_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static std::string hipblaslt_parse_yaml(const std::string& yaml)
+ "hipblaslt_template.yaml -o " + tmp + " " + yaml;
hipblaslt_cerr << cmd << std::endl;

#ifdef WIN32
#ifdef _WIN32
int status = std::system(cmd.c_str());
if(status == -1)
exit(EXIT_FAILURE);
Expand Down
51 changes: 50 additions & 1 deletion clients/common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
#include <stdexcept>
#include <stdlib.h>

#ifdef _WIN32
#include <windows.h>
#include <libloaderapi.h>
#else
#include <fcntl.h>
#endif

#include "Tensile/Source/client/include/Utility.hpp"

Expand All @@ -50,6 +55,27 @@ namespace fs = std::experimental::filesystem;
// Return path of this executable
std::string hipblaslt_exepath()
{
#ifdef _WIN32
std::vector<TCHAR> result(MAX_PATH + 1);
// Ensure result is large enough to accommodate the path
DWORD length = 0;
for(;;)
{
length = GetModuleFileNameA(nullptr, result.data(), result.size());
if(length < result.size() - 1)
{
result.resize(length + 1);
break;
}
result.resize(result.size() * 2);
}

fs::path exepath(result.begin(), result.end());
exepath = exepath.remove_filename();
// Add trailing "/" to exepath if required
exepath += exepath.empty() ? "" : "/";
return exepath.string();
#else
std::string pathstr;
char* path = realpath("/proc/self/exe", 0);
if(path)
Expand All @@ -63,12 +89,26 @@ std::string hipblaslt_exepath()
free(path);
}
return pathstr;
#endif
}

/* ============================================================================================ */
// Temp directory rooted random path
std::string hipblaslt_tempname()
{
#ifdef _WIN32
// Generate "/tmp/rocblas-XXXXXX" like file name
const std::string alphanum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv";
int stringlength = alphanum.length() - 1;
std::string uniquestr = "hipblaslt-";

for(auto n : {0, 1, 2, 3, 4, 5})
uniquestr += alphanum.at(rand() % stringlength);

fs::path tmpname = fs::temp_directory_path() / uniquestr;

return tmpname.string();
#else
char tmp[] = "/tmp/hipblaslt-XXXXXX";
int fd = mkostemp(tmp, O_CLOEXEC);
if(fd == -1)
Expand All @@ -78,6 +118,7 @@ std::string hipblaslt_tempname()
}

return std::string(tmp);
#endif
}

/* ============================================================================================ */
Expand Down Expand Up @@ -239,7 +280,11 @@ hipblaslt_local_handle::hipblaslt_local_handle(const Arguments& arg)
if(sol_selec_env)
m_sol_selec_saved_status = std::string(sol_selec_env);
m_sol_selec_env_set = true;
#ifdef _WIN32
_putenv_s("TENSILE_SOLUTION_SELECTION_METHOD", std::to_string(arg.tensile_solution_selection_method).c_str());
#else
setenv("TENSILE_SOLUTION_SELECTION_METHOD", std::to_string(arg.tensile_solution_selection_method).c_str(), true);
#endif
}
// memory guard control, with multi-threading should not change values across threads
d_vector_set_pad_length(arg.pad);
Expand All @@ -249,7 +294,11 @@ hipblaslt_local_handle::~hipblaslt_local_handle()
{
if(m_sol_selec_env_set)
{
setenv("TENSILE_SOLUTION_SELECTION_METHOD", m_sol_selec_saved_status.c_str(), true);
#ifdef _WIN32
_putenv_s("TENSILE_SOLUTION_SELECTION_METHOD", m_sol_selec_saved_status.c_str());
#else
setenv("TENSILE_SOLUTION_SELECTION_METHOD", m_sol_selec_saved_status.c_str(), true);
#endif
}
hipblasLtDestroy(m_handle);
}
Expand Down
Loading
Loading