Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into cderb/gtest_package
Browse files Browse the repository at this point in the history
  • Loading branch information
cderb committed Dec 18, 2023
2 parents d13348e + c5a2384 commit 48a16ba
Show file tree
Hide file tree
Showing 47 changed files with 1,678 additions and 847 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ if(MIOPEN_USE_HIPRTC)
if(NOT MIOPEN_USE_COMGR)
message(FATAL_ERROR "HIPRTC can be used only together with COMGR")
endif()
if(WIN32)
find_package(hiprtc REQUIRED)
endif()
find_package(hiprtc REQUIRED)
message(STATUS "Build with HIPRTC")
endif()

Expand Down
10 changes: 6 additions & 4 deletions driver/gemm_driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ class GemmDriver : public Driver

T alpha, beta;

miopen::GemmDescriptor gemm_desc;
miopen::GemmDescriptor gemm_desc = {
false, false, false, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0f, 0.0f, miopenFloat, false};
};

template <typename T>
Expand Down Expand Up @@ -198,13 +199,13 @@ int GemmDriver<T>::GetandSetData()
gemm_desc.a_cast_type = data_type;
gemm_desc.b_cast_type = data_type;

gemm_desc.isColMajor = inflags.GetValueInt("isColMajor");
gemm_desc.isColMajor = inflags.GetValueInt("isColMajor") != 0;
gemm_desc.m = inflags.GetValueInt("a_h");
gemm_desc.k = inflags.GetValueInt("a_w");
gemm_desc.n = inflags.GetValueInt("b_w");

gemm_desc.transA = inflags.GetValueInt("transA");
gemm_desc.transB = inflags.GetValueInt("transB");
gemm_desc.transA = inflags.GetValueInt("transA") != 0;
gemm_desc.transB = inflags.GetValueInt("transB") != 0;

gemm_desc.alpha = inflags.GetValueDouble("alpha");
gemm_desc.beta = inflags.GetValueDouble("beta");
Expand All @@ -225,6 +226,7 @@ int GemmDriver<T>::GetandSetData()
gemm_desc.strideB = gemm_desc.k * gemm_desc.n;
gemm_desc.strideC = gemm_desc.m * gemm_desc.n;

gemm_desc.deterministic = false;
return (0);
}

Expand Down
8 changes: 6 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,12 @@ if( MIOPEN_BACKEND STREQUAL "OpenCL")
elseif(MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIP")
target_link_libraries( MIOpen PRIVATE hip::device )
target_link_libraries( MIOpen INTERFACE hip::host )
if(MIOPEN_USE_HIPRTC AND WIN32)
target_link_libraries( MIOpen PRIVATE hiprtc::hiprtc )
if(MIOPEN_USE_HIPRTC)
if(WIN32)
target_link_libraries( MIOpen PRIVATE hiprtc::hiprtc )
else()
target_link_libraries( MIOpen PRIVATE hiprtc)
endif()
endif()
if(ENABLE_HIP_WORKAROUNDS)
# Workaround hip not setting its usage requirements correctly
Expand Down
2 changes: 1 addition & 1 deletion src/activ_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern "C" miopenStatus_t miopenGetActivationDescriptor(miopenActivationDescript
double* activGamma)
{

MIOPEN_LOG_FUNCTION(activDesc, mode, activAlpha, activBeta, activGamma);
MIOPEN_LOG_FUNCTION(activDesc);
return miopen::try_([&] {
*mode = miopen::deref(activDesc).GetMode();
*activAlpha = miopen::deref(activDesc).GetAlpha();
Expand Down
10 changes: 5 additions & 5 deletions src/api/find2_0_commons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ miopenStatus_t miopenSaveSolution(miopenSolution_t solution, char* data)

miopenStatus_t miopenGetSolutionSize(miopenSolution_t solution, size_t* size)
{
MIOPEN_LOG_FUNCTION(solution, size);
MIOPEN_LOG_FUNCTION(solution);

return miopen::try_([&] {
if(size == nullptr)
Expand All @@ -374,7 +374,7 @@ miopenStatus_t miopenGetSolutionSize(miopenSolution_t solution, size_t* size)

miopenStatus_t miopenGetSolutionWorkspaceSize(miopenSolution_t solution, size_t* workspaceSize)
{
MIOPEN_LOG_FUNCTION(solution, workspaceSize);
MIOPEN_LOG_FUNCTION(solution);

return miopen::try_([&] {
const auto& solution_deref = miopen::deref(solution);
Expand All @@ -384,7 +384,7 @@ miopenStatus_t miopenGetSolutionWorkspaceSize(miopenSolution_t solution, size_t*

miopenStatus_t miopenGetSolutionTime(miopenSolution_t solution, float* time)
{
MIOPEN_LOG_FUNCTION(solution, time);
MIOPEN_LOG_FUNCTION(solution);

return miopen::try_([&] {
const auto& solution_deref = miopen::deref(solution);
Expand All @@ -394,7 +394,7 @@ miopenStatus_t miopenGetSolutionTime(miopenSolution_t solution, float* time)

miopenStatus_t miopenGetSolutionSolverId(miopenSolution_t solution, uint64_t* solverId)
{
MIOPEN_LOG_FUNCTION(solution, solverId);
MIOPEN_LOG_FUNCTION(solution);

return miopen::try_([&] {
const auto& solution_deref = miopen::deref(solution);
Expand All @@ -404,7 +404,7 @@ miopenStatus_t miopenGetSolutionSolverId(miopenSolution_t solution, uint64_t* so

miopenStatus_t miopenGetSolverIdConvAlgorithm(uint64_t solverId, miopenConvAlgorithm_t* result)
{
MIOPEN_LOG_FUNCTION(solverId, result);
MIOPEN_LOG_FUNCTION(solverId);

return miopen::try_([&] {
const auto id_deref = miopen::solver::Id{solverId};
Expand Down
35 changes: 16 additions & 19 deletions src/convolution_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ extern "C" miopenStatus_t miopenInitConvolutionNdDescriptor(miopenConvolutionDes
extern "C" miopenStatus_t miopenGetConvolutionGroupCount(miopenConvolutionDescriptor_t convDesc,
int* groupCount)
{
MIOPEN_LOG_FUNCTION(convDesc, groupCount);
MIOPEN_LOG_FUNCTION(convDesc);
return miopen::try_([&] { miopen::deref(groupCount) = miopen::deref(convDesc).group_count; });
}

Expand Down Expand Up @@ -254,7 +254,7 @@ extern "C" miopenStatus_t miopenGetConvolutionDescriptor(miopenConvolutionDescri
int* dilation_h,
int* dilation_w)
{
MIOPEN_LOG_FUNCTION(convDesc, c_mode, pad_h, pad_w, stride_h, stride_w, dilation_h, dilation_w);
MIOPEN_LOG_FUNCTION(convDesc);
return miopen::try_([&] {
if(miopen::deref(convDesc).GetSpatialDimension() != 2)
{
Expand All @@ -279,8 +279,7 @@ extern "C" miopenStatus_t miopenGetConvolutionNdDescriptor(miopenConvolutionDesc
int* dilationA,
miopenConvolutionMode_t* c_mode)
{
MIOPEN_LOG_FUNCTION(
convDesc, requestedSpatialDim, spatialDim, padA, strideA, dilationA, c_mode);
MIOPEN_LOG_FUNCTION(convDesc, requestedSpatialDim);
return miopen::try_([&] {
int spatial_dim = miopen::deref(convDesc).GetSpatialDimension();
if(spatial_dim < requestedSpatialDim)
Expand All @@ -305,7 +304,7 @@ extern "C" miopenStatus_t miopenGetConvolutionNdDescriptor(miopenConvolutionDesc
extern "C" miopenStatus_t miopenGetConvolutionSpatialDim(miopenConvolutionDescriptor_t convDesc,
int* spatialDim)
{
MIOPEN_LOG_FUNCTION(convDesc, spatialDim);
MIOPEN_LOG_FUNCTION(convDesc);
return miopen::try_(
[&] { miopen::deref(spatialDim) = miopen::deref(convDesc).GetSpatialDimension(); });
}
Expand All @@ -319,7 +318,7 @@ miopenGetConvolutionForwardOutputDim(miopenConvolutionDescriptor_t convDesc,
int* h,
int* w)
{
MIOPEN_LOG_FUNCTION(convDesc, inputTensorDesc, filterDesc, n, c, h, w);
MIOPEN_LOG_FUNCTION(convDesc, inputTensorDesc, filterDesc);
return miopen::try_([&] {
if(miopen::deref(convDesc).GetSpatialDimension() != 2)
{
Expand All @@ -340,7 +339,7 @@ miopenGetConvolutionNdForwardOutputDim(miopenConvolutionDescriptor_t convDesc,
int* nDim,
int* outputTensorDimA)
{
MIOPEN_LOG_FUNCTION(convDesc, inputTensorDesc, filterDesc, nDim, outputTensorDimA);
MIOPEN_LOG_FUNCTION(convDesc, inputTensorDesc, filterDesc);
return miopen::try_([&] {
auto out_desc = miopen::deref(convDesc).GetForwardOutputTensor(
miopen::deref(inputTensorDesc), miopen::deref(filterDesc));
Expand Down Expand Up @@ -369,7 +368,7 @@ miopenConvolutionForwardGetWorkSpaceSize(miopenHandle_t handle,
size_t* workSpaceSize)
{

MIOPEN_LOG_FUNCTION(handle, wDesc, xDesc, convDesc, yDesc, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, wDesc, xDesc, convDesc, yDesc);
return miopen::try_([&] {
auto ctx = ExecutionContext{};
auto problem = ProblemDescription{};
Expand Down Expand Up @@ -690,7 +689,7 @@ miopenConvolutionForwardGetSolutionWorkspaceSize(miopenHandle_t handle,
const uint64_t solution_id,
size_t* workSpaceSize)
{
MIOPEN_LOG_FUNCTION(handle, wDesc, xDesc, convDesc, yDesc, solution_id, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, wDesc, xDesc, convDesc, yDesc, solution_id);
return miopen::try_([&] {
if(miopen::deref(convDesc).mode == miopenTranspose)
{
Expand Down Expand Up @@ -806,7 +805,7 @@ miopenConvolutionBackwardDataGetSolution(miopenHandle_t handle,
size_t* solutionCount,
miopenConvSolution_t* solutions)
{
MIOPEN_LOG_FUNCTION(handle, dyDesc, wDesc, convDesc, dxDesc, maxSolutionCount, solutionCount);
MIOPEN_LOG_FUNCTION(handle, dyDesc, wDesc, convDesc, dxDesc, maxSolutionCount);
return miopen::try_([&] {
auto ctx = ExecutionContext{};
auto problem = ProblemDescription{};
Expand All @@ -829,7 +828,7 @@ miopenConvolutionBackwardDataGetSolutionWorkspaceSize(miopenHandle_t handle,
const uint64_t solution_id,
size_t* workSpaceSize)
{
MIOPEN_LOG_FUNCTION(handle, dyDesc, wDesc, convDesc, dxDesc, solution_id, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, dyDesc, wDesc, convDesc, dxDesc, solution_id);
return miopen::try_([&] {
if(miopen::deref(convDesc).mode == miopenTranspose)
{
Expand Down Expand Up @@ -924,7 +923,7 @@ miopenConvolutionBackwardWeightsGetSolutionCount(miopenHandle_t handle,
const miopenTensorDescriptor_t dwDesc,
size_t* solutionCount)
{
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc, solutionCount);
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc);
return miopen::try_([&] {
auto ctx = ExecutionContext{};
auto problem = ProblemDescription{};
Expand All @@ -944,7 +943,7 @@ miopenConvolutionBackwardWeightsGetSolution(miopenHandle_t handle,
size_t* solutionCount,
miopenConvSolution_t* solutions)
{
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc, maxSolutionCount, solutionCount);
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc, maxSolutionCount);
return miopen::try_([&] {
auto ctx = ExecutionContext{};
auto problem = ProblemDescription{};
Expand All @@ -967,7 +966,7 @@ extern "C" miopenStatus_t miopenConvolutionBackwardWeightsGetSolutionWorkspaceSi
const uint64_t solution_id,
size_t* workSpaceSize)
{
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc, solution_id, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc, solution_id);
return miopen::try_([&] {
if(miopen::deref(convDesc).mode == miopenTranspose)
{
Expand Down Expand Up @@ -1208,8 +1207,7 @@ miopenConvolutionBackwardDataGetWorkSpaceSize(miopenHandle_t handle,
const miopenTensorDescriptor_t dxDesc,
size_t* workSpaceSize)
{

MIOPEN_LOG_FUNCTION(handle, dyDesc, wDesc, convDesc, dxDesc, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, dyDesc, wDesc, convDesc, dxDesc);
return miopen::try_([&] {
auto ctx = ExecutionContext{};
auto problem = ProblemDescription{};
Expand All @@ -1226,8 +1224,7 @@ miopenConvolutionBackwardWeightsGetWorkSpaceSize(miopenHandle_t handle,
const miopenTensorDescriptor_t dwDesc,
size_t* workSpaceSize)
{

MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, dyDesc, xDesc, convDesc, dwDesc);
return miopen::try_([&] {
auto ctx = ExecutionContext{};
auto problem = ProblemDescription{};
Expand Down Expand Up @@ -1378,7 +1375,7 @@ extern "C" miopenStatus_t miopenGetConvolutionAttribute(miopenConvolutionDescrip
const miopenConvolutionAttrib_t attr,
int* const value)
{
MIOPEN_LOG_FUNCTION(convDesc, attr, value);
MIOPEN_LOG_FUNCTION(convDesc, attr);
return miopen::try_(
[&] { miopen::deref(value) = miopen::deref(convDesc).attribute.Get(attr); });
}
12 changes: 3 additions & 9 deletions src/ctc_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ extern "C" miopenStatus_t miopenGetCTCLossDescriptor(miopenCTCLossDescriptor_t c
int* blank_label_id = nullptr,
bool* apply_softmax_layer = nullptr)
{
MIOPEN_LOG_FUNCTION(ctcLossDesc, dataType, blank_label_id, apply_softmax_layer);
MIOPEN_LOG_FUNCTION(ctcLossDesc);
return miopen::try_([&] {
miopen::deref(dataType) = miopen::deref(ctcLossDesc).dataType;
if(blank_label_id != nullptr)
Expand Down Expand Up @@ -82,14 +82,8 @@ miopenGetCTCLossWorkspaceSize(miopenHandle_t handle,
const miopenCTCLossDescriptor_t ctcLossDesc,
size_t* workSpaceSize)
{
MIOPEN_LOG_FUNCTION(probsDesc,
gradientsDesc,
labels,
labelLengths,
inputLengths,
algo,
ctcLossDesc,
workSpaceSize);
MIOPEN_LOG_FUNCTION(
probsDesc, gradientsDesc, labels, labelLengths, inputLengths, algo, ctcLossDesc);

return miopen::try_([&] {
miopen::deref(workSpaceSize) = miopen::deref(ctcLossDesc)
Expand Down
9 changes: 3 additions & 6 deletions src/dropout_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ extern "C" miopenStatus_t miopenCreateDropoutDescriptor(miopenDropoutDescriptor_

extern "C" miopenStatus_t miopenDestroyDropoutDescriptor(miopenDropoutDescriptor_t dropoutDesc)
{

MIOPEN_LOG_FUNCTION(dropoutDesc);
return miopen::try_([&] { miopen_destroy_object(dropoutDesc); });
}

extern "C" miopenStatus_t miopenDropoutGetReserveSpaceSize(const miopenTensorDescriptor_t xDesc,
size_t* reserveSpaceSizeInBytes)
{

MIOPEN_LOG_FUNCTION(xDesc, reserveSpaceSizeInBytes);
MIOPEN_LOG_FUNCTION(xDesc);
return miopen::try_([&] {
miopen::deref(reserveSpaceSizeInBytes) =
miopen::deref(xDesc).GetElementSize() * sizeof(bool);
Expand All @@ -58,8 +56,7 @@ extern "C" miopenStatus_t miopenDropoutGetReserveSpaceSize(const miopenTensorDes
extern "C" miopenStatus_t miopenDropoutGetStatesSize(miopenHandle_t handle,
size_t* stateSizeInBytes)
{

MIOPEN_LOG_FUNCTION(stateSizeInBytes);
MIOPEN_LOG_FUNCTION(handle);
return miopen::try_([&] {
miopen::deref(stateSizeInBytes) =
std::min(size_t(MAX_PRNG_STATE), miopen::deref(handle).GetImage3dMaxWidth()) *
Expand All @@ -76,7 +73,7 @@ extern "C" miopenStatus_t miopenGetDropoutDescriptor(miopenDropoutDescriptor_t d
bool* state_evo,
miopenRNGType_t* rng_mode)
{
MIOPEN_LOG_FUNCTION(dropoutDesc, dropout, states, seed, use_mask, state_evo);
MIOPEN_LOG_FUNCTION(dropoutDesc);
return miopen::try_([&] {
miopen::deref(dropout) = miopen::deref(dropoutDesc).dropout;
miopen::deref(states) = &(miopen::deref(dropoutDesc).pstates);
Expand Down
4 changes: 2 additions & 2 deletions src/fused_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ miopenFusionPlanGetWorkSpaceSize(miopenHandle_t handle,
size_t* workSpaceSize,
miopenConvFwdAlgorithm_t algo)
{
MIOPEN_LOG_FUNCTION(handle, fusePlanDesc, workSpaceSize);
MIOPEN_LOG_FUNCTION(handle, fusePlanDesc, algo);
miopenStatus_t res = miopenStatusUnknownError;
miopen::try_([&] {
size_t sz;
Expand All @@ -103,7 +103,7 @@ miopenFusionPlanConvolutionGetAlgo(miopenFusionPlanDescriptor_t fusePlanDesc,
int* returnedAlgoCount,
miopenConvFwdAlgorithm_t* returnedAlgos)
{
MIOPEN_LOG_FUNCTION(fusePlanDesc, requestAlgoCount, returnedAlgoCount, returnedAlgos);
MIOPEN_LOG_FUNCTION(fusePlanDesc, requestAlgoCount);
miopenStatus_t res = miopenStatusUnknownError;
miopen::try_([&] {
int cnt = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/include/miopen/gemm_v2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct GemmDescriptor
miopenDataType_t a_cast_type;
miopenDataType_t b_cast_type;
ConvolutionAttribute conv_attributes;
GemmDescriptor() {}
GemmDescriptor() = delete;
GemmDescriptor(bool isColMajor_,
bool transA_,
bool transB_,
Expand Down
4 changes: 2 additions & 2 deletions src/lrn_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ extern "C" miopenStatus_t miopenGetLRNDescriptor(const miopenLRNDescriptor_t lrn
double* lrnBeta,
double* lrnK)
{

MIOPEN_LOG_FUNCTION(lrnDesc, mode, lrnN, lrnAlpha, lrnBeta, lrnK);
MIOPEN_LOG_FUNCTION(lrnDesc);
return miopen::try_([&] {
*mode = miopen::deref(lrnDesc).GetMode();
*lrnN = miopen::deref(lrnDesc).GetN();
Expand All @@ -70,6 +69,7 @@ extern "C" miopenStatus_t miopenGetLRNDescriptor(const miopenLRNDescriptor_t lrn
extern "C" miopenStatus_t miopenLRNGetWorkSpaceSize(const miopenTensorDescriptor_t yDesc,
size_t* workSpaceSize)
{
MIOPEN_LOG_FUNCTION(yDesc);

// TODO: Supporting size 4 bytes only
return miopen::try_([&] {
Expand Down
Loading

0 comments on commit 48a16ba

Please sign in to comment.