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

Fix builds with rocBLAS that does not support F8 #2480

Merged
merged 7 commits into from
Nov 2, 2023
17 changes: 15 additions & 2 deletions src/gemm_v2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
/// Let's pass literal value as a workaround; there should be no harm.
#define USE_GEMM_FLAGS_FP16_ALT_IMPL_242 (MIOPEN_ROCBLAS_VERSION_FLAT == 2042000)

#define F8_SUPPORTED (MIOPEN_ROCBLAS_VERSION_FLAT > 3000000)
junliume marked this conversation as resolved.
Show resolved Hide resolved

static inline uint32_t
FlagsForRocblasFp32Fp16Call(const miopen::GemmDescriptor& desc) // bool gfx90aFp16Alt)
{
Expand Down Expand Up @@ -114,11 +116,15 @@ static inline rocblas_datatype rocBlasComputeType(const miopen::GemmDescriptor&

auto rocBlasDataType(miopenDataType_t data_type)
{
/// \todo Not all supported data types are handled here.
/// This is fine so far because this function is used only with FP16/F8.
#if F8_SUPPORTED
if(data_type == miopenFloat8)
return rocblas_datatype::rocblas_datatype_f8_r;
else if(data_type == miopenBFloat8)
if(data_type == miopenBFloat8)
return rocblas_datatype::rocblas_datatype_bf8_r;
else if(data_type == miopenHalf)
#endif
if(data_type == miopenHalf)
return rocblas_datatype::rocblas_datatype_f16_r;
MIOPEN_THROW(miopenStatusInternalError, "Invalid data type passed");
}
Expand Down Expand Up @@ -172,6 +178,13 @@ rocblas_status miopen_rocblas_gemm_ex3(const miopen::Handle& handle,
flags); // gfx90a_alt_impl));
return rb_status;
#pragma clang diagnostic pop
#else
std::ignore = A;
std::ignore = a_offset;
std::ignore = B;
std::ignore = b_offset;
std::ignore = C;
std::ignore = c_offset;
#endif
MIOPEN_THROW(miopenStatusBadParm, "An appropriate version of rocBLAS is required for this op");
std::ignore = handle;
Expand Down