Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright (C) 2022 Advanced Micro Devices, Inc.
# Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -163,7 +163,7 @@ else()
message(STATUS "AMDGPU_TARGETS: ${AMDGPU_TARGETS}")

if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
find_package( hip REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm )
find_package( hip 5.5 REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm )
endif( )

option( BUILD_WITH_TENSILE "Build full functionality which requires tensile?" ON )
Expand Down Expand Up @@ -225,7 +225,6 @@ else()
endif()
endif()

find_package( hipblas 0.50.0 REQUIRED CONFIG PATHS ${HIP_DIR} ${ROCM_PATH} /opt/rocm)

# Setup version
set(VERSION_STRING "0.1.0")
Expand Down Expand Up @@ -292,10 +291,6 @@ if( BUILD_CLIENTS_SAMPLES OR BUILD_CLIENTS_TESTS OR BUILD_CLIENTS_BENCHMARKS )
add_subdirectory( clients )
endif( )

if( NOT BUILD_CUDA )
rocm_package_add_dependencies(DEPENDS "hipblas >= 0.50.0")
endif( )

# Package specific CPACK vars
set( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md" )
set( CPACK_RPM_PACKAGE_LICENSE "MIT")
Expand Down
4 changes: 2 additions & 2 deletions clients/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright (C) 2022 Advanced Micro Devices, Inc.
# Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -43,7 +43,7 @@ target_include_directories( hipblaslt-bench
$<BUILD_INTERFACE:${BLIS_INCLUDE_DIR}> # may be blank if not used
)

target_link_libraries( hipblaslt-bench PRIVATE ${BLAS_LIBRARY} roc::hipblas roc::hipblaslt)
target_link_libraries( hipblaslt-bench PRIVATE ${BLAS_LIBRARY} roc::hipblaslt)

if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# GCC or hip-clang needs specific flags to turn on f16c intrinsics
Expand Down
20 changes: 10 additions & 10 deletions clients/benchmarks/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2022 Advanced Micro Devices, Inc.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -68,7 +68,7 @@ void run_function(const func_map& map, const Arguments& arg, const std::string&
auto match = map.find(arg.function);
if(match == map.end())
throw std::invalid_argument("Invalid combination --function "s + arg.function
+ " --a_type "s + hipblas_datatype_to_string(arg.a_type) + msg);
+ " --a_type "s + hip_datatype_to_string(arg.a_type) + msg);
match->second(arg);
}

Expand Down Expand Up @@ -462,33 +462,33 @@ try

std::transform(precision.begin(), precision.end(), precision.begin(), ::tolower);
auto prec = string_to_hipblas_datatype(precision);
if(prec == static_cast<hipblasDatatype_t>(-1))
if(prec == static_cast<hipDataType>(-1))
throw std::invalid_argument("Invalid value for --precision " + precision);

arg.a_type = a_type == "" ? prec : string_to_hipblas_datatype(a_type);
if(arg.a_type == static_cast<hipblasDatatype_t>(-1))
if(arg.a_type == static_cast<hipDataType>(-1))
throw std::invalid_argument("Invalid value for --a_type " + a_type);

arg.b_type = b_type == "" ? prec : string_to_hipblas_datatype(b_type);
if(arg.b_type == static_cast<hipblasDatatype_t>(-1))
if(arg.b_type == static_cast<hipDataType>(-1))
throw std::invalid_argument("Invalid value for --b_type " + b_type);

arg.c_type = c_type == "" ? prec : string_to_hipblas_datatype(c_type);
if(arg.c_type == static_cast<hipblasDatatype_t>(-1))
if(arg.c_type == static_cast<hipDataType>(-1))
throw std::invalid_argument("Invalid value for --c_type " + c_type);

arg.d_type = d_type == "" ? prec : string_to_hipblas_datatype(d_type);
if(arg.d_type == static_cast<hipblasDatatype_t>(-1))
if(arg.d_type == static_cast<hipDataType>(-1))
throw std::invalid_argument("Invalid value for --d_type " + d_type);

bool is_f16 = arg.a_type == HIPBLAS_R_16F || arg.a_type == HIPBLAS_R_16B;
bool is_f32 = arg.a_type == HIPBLAS_R_32F;
bool is_f16 = arg.a_type == HIP_R_16F || arg.a_type == HIP_R_16BF;
bool is_f32 = arg.a_type == HIP_R_32F;
arg.compute_type = compute_type == "" ? (HIPBLASLT_COMPUTE_F32)
: string_to_hipblaslt_computetype(compute_type);
if(arg.compute_type == static_cast<hipblasLtComputeType_t>(-1))
throw std::invalid_argument("Invalid value for --compute_type " + compute_type);

if(string_to_hipblas_datatype(bias_type) == static_cast<hipblasDatatype_t>(-1)
if(string_to_hipblas_datatype(bias_type) == static_cast<hipDataType>(-1)
&& bias_type != "" && bias_type != "default")
throw std::invalid_argument("Invalid value for --bias_type " + bias_type);
else
Expand Down
46 changes: 23 additions & 23 deletions clients/common/cblas_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2022 Advanced Micro Devices, Inc.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,23 +30,23 @@
#include <iostream>
#include <omp.h>

CBLAS_TRANSPOSE HIPOperationToCBLASTanspose(hipblasOperation_t trans)
CBLAS_TRANSPOSE HIPOperationToCBLASTanspose(hipblasltOperation_t trans)
{
switch(trans)
{
case HIPBLAS_OP_N:
case HIPBLASLT_OP_N:
return CblasNoTrans;
case HIPBLAS_OP_T:
case HIPBLASLT_OP_T:
return CblasTrans;
case HIPBLAS_OP_C:
case HIPBLASLT_OP_C:
return CblasConjTrans;
}
}

// gemm
template <>
void cblas_gemm<hip_bfloat16, hip_bfloat16, float>(hipblasOperation_t transA,
hipblasOperation_t transB,
void cblas_gemm<hip_bfloat16, hip_bfloat16, float>(hipblasltOperation_t transA,
hipblasltOperation_t transB,
int64_t m,
int64_t n,
int64_t k,
Expand All @@ -63,8 +63,8 @@ void cblas_gemm<hip_bfloat16, hip_bfloat16, float>(hipblasOperation_t transA,
// cblas does not support hip_bfloat16, so convert to higher precision float
// This will give more precise result which is acceptable for testing

size_t sizeA = (transA == HIPBLAS_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLAS_OP_N ? n : k) * size_t(ldb);
size_t sizeA = (transA == HIPBLASLT_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLASLT_OP_N ? n : k) * size_t(ldb);
size_t sizeC = n * size_t(ldc);

host_vector<float> A_float(sizeA), B_float(sizeB), C_float(sizeC);
Expand Down Expand Up @@ -98,8 +98,8 @@ void cblas_gemm<hip_bfloat16, hip_bfloat16, float>(hipblasOperation_t transA,
}

template <>
void cblas_gemm<hip_bfloat16, float, float>(hipblasOperation_t transA,
hipblasOperation_t transB,
void cblas_gemm<hip_bfloat16, float, float>(hipblasltOperation_t transA,
hipblasltOperation_t transB,
int64_t m,
int64_t n,
int64_t k,
Expand All @@ -116,8 +116,8 @@ void cblas_gemm<hip_bfloat16, float, float>(hipblasOperation_t transA,
// cblas does not support hip_bfloat16, so convert to higher precision float
// This will give more precise result which is acceptable for testing

size_t sizeA = (transA == HIPBLAS_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLAS_OP_N ? n : k) * size_t(ldb);
size_t sizeA = (transA == HIPBLASLT_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLASLT_OP_N ? n : k) * size_t(ldb);
size_t sizeC = n * size_t(ldc);

host_vector<float> A_float(sizeA), B_float(sizeB), C_float(sizeC);
Expand Down Expand Up @@ -146,8 +146,8 @@ void cblas_gemm<hip_bfloat16, float, float>(hipblasOperation_t transA,
}

template <>
void cblas_gemm<hipblasLtHalf, hipblasLtHalf, float>(hipblasOperation_t transA,
hipblasOperation_t transB,
void cblas_gemm<hipblasLtHalf, hipblasLtHalf, float>(hipblasltOperation_t transA,
hipblasltOperation_t transB,
int64_t m,
int64_t n,
int64_t k,
Expand All @@ -164,8 +164,8 @@ void cblas_gemm<hipblasLtHalf, hipblasLtHalf, float>(hipblasOperation_t transA
// cblas does not support hipblasLtHalf, so convert to higher precision float
// This will give more precise result which is acceptable for testing

size_t sizeA = (transA == HIPBLAS_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLAS_OP_N ? n : k) * size_t(ldb);
size_t sizeA = (transA == HIPBLASLT_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLASLT_OP_N ? n : k) * size_t(ldb);
size_t sizeC = n * size_t(ldc);

host_vector<float> A_float(sizeA), B_float(sizeB), C_float(sizeC);
Expand Down Expand Up @@ -211,8 +211,8 @@ void cblas_gemm<hipblasLtHalf, hipblasLtHalf, float>(hipblasOperation_t transA
}

template <>
void cblas_gemm<hipblasLtHalf, float, float>(hipblasOperation_t transA,
hipblasOperation_t transB,
void cblas_gemm<hipblasLtHalf, float, float>(hipblasltOperation_t transA,
hipblasltOperation_t transB,
int64_t m,
int64_t n,
int64_t k,
Expand All @@ -229,8 +229,8 @@ void cblas_gemm<hipblasLtHalf, float, float>(hipblasOperation_t transA,
// cblas does not support hipblasLtHalf, so convert to higher precision float
// This will give more precise result which is acceptable for testing

size_t sizeA = (transA == HIPBLAS_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLAS_OP_N ? n : k) * size_t(ldb);
size_t sizeA = (transA == HIPBLASLT_OP_N ? k : m) * size_t(lda);
size_t sizeB = (transB == HIPBLASLT_OP_N ? n : k) * size_t(ldb);

host_vector<float> A_float(sizeA), B_float(sizeB);

Expand Down Expand Up @@ -268,8 +268,8 @@ void cblas_gemm<hipblasLtHalf, float, float>(hipblasOperation_t transA,
}

template <>
void cblas_gemm<float, float, float>(hipblasOperation_t transA,
hipblasOperation_t transB,
void cblas_gemm<float, float, float>(hipblasltOperation_t transA,
hipblasltOperation_t transB,
int64_t m,
int64_t n,
int64_t k,
Expand Down
14 changes: 7 additions & 7 deletions clients/common/hipblaslt_arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2022 Advanced Micro Devices, Inc.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -68,12 +68,12 @@ void Arguments::init()
algo = 0;
solution_index = 0;

a_type = HIPBLAS_R_16F;
b_type = HIPBLAS_R_16F;
c_type = HIPBLAS_R_16F;
d_type = HIPBLAS_R_16F;
a_type = HIP_R_16F;
b_type = HIP_R_16F;
c_type = HIP_R_16F;
d_type = HIP_R_16F;
compute_type = HIPBLASLT_COMPUTE_F32;
scale_type = HIPBLAS_R_32F;
scale_type = HIP_R_32F;

initialization = hipblaslt_initialization::hpl;

Expand All @@ -97,7 +97,7 @@ void Arguments::init()
activation_type = hipblaslt_activation_type::none;
activation_arg1 = 0.0f;
activation_arg2 = std::numeric_limits<float>::infinity();
bias_type = static_cast<hipblasDatatype_t>(-1);
bias_type = static_cast<hipDataType>(-1);
bias_vector = false;
c_noalias_d = false;
HMM = false;
Expand Down
18 changes: 9 additions & 9 deletions clients/common/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2022 Advanced Micro Devices, Inc.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -146,8 +146,8 @@ double get_time_us_no_sync(void)
int64_t query_device_property()
{
int device_count;
hipblasStatus_t status = (hipblasStatus_t)hipGetDeviceCount(&device_count);
if(status != HIPBLAS_STATUS_SUCCESS)
hipblasltStatus_t status = (hipblasltStatus_t)hipGetDeviceCount(&device_count);
if(status != HIPBLASLT_STATUS_SUCCESS)
{
hipblaslt_cerr << "Query device error: cannot get device count" << std::endl;
return -1;
Expand All @@ -168,8 +168,8 @@ int64_t query_device_property()
break;

hipDeviceProp_t props;
hipblasStatus_t status = (hipblasStatus_t)hipGetDeviceProperties(&props, i);
if(status != HIPBLAS_STATUS_SUCCESS)
hipblasltStatus_t status = (hipblasltStatus_t)hipGetDeviceProperties(&props, i);
if(status != HIPBLASLT_STATUS_SUCCESS)
{
hipblaslt_cerr << "Query device error: cannot get device ID " << i << "'s property"
<< std::endl;
Expand Down Expand Up @@ -206,8 +206,8 @@ int64_t query_device_property()
/* set current device to device_id */
void set_device(int64_t device_id)
{
hipblasStatus_t status = (hipblasStatus_t)hipSetDevice(device_id);
if(status != HIPBLAS_STATUS_SUCCESS)
hipblasltStatus_t status = (hipblasltStatus_t)hipSetDevice(device_id);
if(status != HIPBLASLT_STATUS_SUCCESS)
{
hipblaslt_cerr << "Set device error: cannot set device ID " << device_id
<< ", there may not be such device ID" << std::endl;
Expand All @@ -221,8 +221,8 @@ void set_device(int64_t device_id)
hipblaslt_local_handle::hipblaslt_local_handle()
{
auto status = hipblasLtCreate(&m_handle);
if(status != HIPBLAS_STATUS_SUCCESS)
throw std::runtime_error(hipblas_status_to_string(status));
if(status != HIPBLASLT_STATUS_SUCCESS)
throw std::runtime_error(hipblaslt_status_to_string(status));

#ifdef GOOGLE_TEST
if(t_set_stream_callback)
Expand Down
4 changes: 2 additions & 2 deletions clients/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright (C) 2022 Advanced Micro Devices, Inc.
# Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -53,7 +53,7 @@ target_include_directories( hipblaslt-test
$<BUILD_INTERFACE:${GTEST_INCLUDE_DIRS}>
)
message("BLIS_INCLUDE_DIR=" ${BLIS_INCLUDE_DIR})
target_link_libraries( hipblaslt-test PRIVATE ${BLAS_LIBRARY} ${GTEST_BOTH_LIBRARIES} roc::hipblas roc::hipblaslt )
target_link_libraries( hipblaslt-test PRIVATE ${BLAS_LIBRARY} ${GTEST_BOTH_LIBRARIES} roc::hipblaslt )

if( NOT BUILD_CUDA )
target_link_libraries( hipblaslt-test PRIVATE hip::host hip::device )
Expand Down
4 changes: 2 additions & 2 deletions clients/gtest/auxiliary_gtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2022 Advanced Micro Devices, Inc.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -142,7 +142,7 @@ namespace
{
RocBlasLt_TestName<aux_test> name(arg.name);

name << hipblas_datatype_to_string(arg.a_type);
name << hip_datatype_to_string(arg.a_type);

return std::move(name);
}
Expand Down
4 changes: 2 additions & 2 deletions clients/gtest/hipblaslt_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*
* MIT License
*
* Copyright (C) 2022 Advanced Micro Devices, Inc.
* Copyright (C) 2022-2023 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -376,7 +376,7 @@ bool match_test_category(const Arguments& arg, const char* category)

// The name of the current GPU platform
char* archName;
if(hipblasLtGetArchName(&archName) != HIPBLAS_STATUS_SUCCESS)
if(hipblasLtGetArchName(&archName) != HIPBLASLT_STATUS_SUCCESS)
return false;
static const std::string platform(archName);

Expand Down
Loading