Skip to content

Commit

Permalink
Revert "[HotFix] revert #2580 and re-enable smoke tests (#2616)"
Browse files Browse the repository at this point in the history
This reverts commit c567b2e.
  • Loading branch information
cderb committed Dec 19, 2023
1 parent 700e2e7 commit ed002f5
Show file tree
Hide file tree
Showing 16 changed files with 1,028 additions and 165 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/update_develop_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Sync branch

on:
pull_request:
workflow_dispatch:
push:
branches:
- develop
jobs:
sync-branch:
name: Update nightly branch
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@main
- uses: connor-baer/action-sync-branch@main
with:
branch: develop_nightly
token: ${{ secrets.GITHUB_TOKEN }}
force: false
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,15 @@ pipeline {
description: "")
booleanParam(
name: "BUILD_SMOKE_FP32",
defaultValue: true,
defaultValue: env.BRANCH_NAME == env.NIGHTLY_BRANCH ? true : false,
description: "")
booleanParam(
name: "BUILD_SMOKE_AUX1",
defaultValue: true,
defaultValue: env.BRANCH_NAME == env.NIGHTLY_BRANCH ? true : false,
description: "")
booleanParam(
name: "BUILD_SMOKE_FP16_BF16_INT8",
defaultValue: true,
defaultValue: env.BRANCH_NAME == env.NIGHTLY_BRANCH ? true : false,
description: "")
booleanParam(
name: "BUILD_FULL_TESTS",
Expand Down
22 changes: 0 additions & 22 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -673,20 +673,6 @@ function(add_custom_test NAME)
set_tests_properties(${NAME} PROPERTIES DISABLED On)
endif()
endfunction()
if(${CODECOV_TEST})
add_custom_test(test_conv3d_codecov
COMMAND $<TARGET_FILE:test_conv3d> ${MIOPEN_TEST_FLOAT_ARG} --input 2 4 4 4 4 --weights 2 4 1 1 1 --pads_strides_dilations 0 0 0 1 1 1 1 1 1 ${MIOPEN_TEST_FLAGS_ARGS}
)
add_custom_test(test_immed_conv2d_codecov
COMMAND $<TARGET_FILE:test_immed_conv2d> ${MIOPEN_TEST_FLOAT_ARG} --input 2 2 14 14 --weights 8 2 3 3 --pads_strides_dilations 0 0 1 1 1 1 ${MIOPEN_TEST_FLAGS_ARGS}
)
add_custom_test(test_immed_conv3d_codecov
COMMAND $<TARGET_FILE:test_immed_conv3d> ${MIOPEN_TEST_FLOAT_ARG} --input 1 4 4 4 4 --weights 2 4 3 3 3 --pads_strides_dilations 0 0 0 1 1 1 1 1 1 ${MIOPEN_TEST_FLAGS_ARGS}
)
add_custom_test(test_pooling2d_codecov
COMMAND $<TARGET_FILE:test_pooling2d> ${MIOPEN_TEST_FLOAT_ARG} --input 1, 192, 28, 28 --lens 2 2 --strides 2 2 --pads 0 0 ${MIOPEN_TEST_FLAGS_ARGS}
)
endif()

if(${MIOPEN_TEST_WITH_MIOPENDRIVER})
add_custom_test(test_miopendriver_regression_issue_1576 SKIP_UNLESS_ALL GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED FLOAT_DISABLED HALF_ENABLED
Expand Down Expand Up @@ -776,14 +762,6 @@ set(TEST_CONV_VERBOSE_F ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-backward-da
set(TEST_CONV_VERBOSE_B ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-forward --disable-backward-weights)
set(TEST_CONV_VERBOSE_W ${MIOPEN_TEST_FLOAT_ARG} --verbose --disable-forward --disable-backward-data)

add_custom_test(test_pooling2d_asymmetric SKIP_UNLESS_ALL HALF_ENABLED GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED
COMMAND $<TARGET_FILE:test_pooling2d> ${MIOPEN_TEST_FLOAT_ARG} --all --dataset 1 --limit 0 ${MIOPEN_TEST_FLAGS_ARGS}
)

add_custom_test(test_pooling2d_wide SKIP_UNLESS_ALL HALF_ENABLED GFX94X_ENABLED GFX103X_ENABLED GFX110X_ENABLED
COMMAND $<TARGET_FILE:test_pooling2d> ${MIOPEN_TEST_FLOAT_ARG} --all --dataset 2 --limit 0 ${MIOPEN_TEST_FLAGS_ARGS}
)

set(IMPLICITGEMM_MLIR_ENV_F_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmFwdXdlops)
set(IMPLICITGEMM_MLIR_ENV_B_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmBwdXdlops)
set(IMPLICITGEMM_MLIR_ENV_W_XDLOPS ${IMPLICITGEMM_MLIR_ENV_BASE} MIOPEN_DEBUG_FIND_ONLY_SOLVER=ConvMlirIgemmWrWXdlops)
Expand Down
12 changes: 5 additions & 7 deletions test/immed_conv3d.cpp → test/conv3d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "conv_common.hpp"

template <class T>
struct conv3d_driver : conv_driver<T, ConvApi::Immediate>
struct conv3d_driver : conv_driver<T>
{
conv3d_driver() : conv_driver<T, ConvApi::Immediate>()
conv3d_driver() : conv_driver<T>()
{
this->add(this->input_dims, "input");
this->add(this->weight_tensor_dims, "weights");
Expand All @@ -37,16 +37,16 @@ struct conv3d_driver : conv_driver<T, ConvApi::Immediate>
this->generate_data_limited(this->get_batch_sizes(), 1, {8}));
this->add(this->input_channels,
"input_channels",
this->generate_data_limited(this->get_input_channels(), 1, {2}));
this->generate_data_limited(this->get_input_channels(), 1, {32}));
this->add(this->output_channels,
"output_channels",
this->generate_data_limited(this->get_output_channels(), 1, {16}));
this->generate_data_limited(this->get_output_channels(), 1, {32}));
this->add(this->spatial_dim_elements,
"spatial_dim_elements",
this->generate_data_limited(this->get_3d_spatial_dims(), 1, {16, 16, 16}));
this->add(this->filter_dims,
"filter_dims",
this->generate_data_limited(this->get_3d_filter_dims(), 2, {5, 5, 5}));
this->generate_data_limited(this->get_3d_filter_dims(), 2, {3, 3, 3}));
this->add(this->pads_strides_dilations,
"pads_strides_dilations",
this->generate_data_limited(this->get_3d_pads_strides_dilations(), 2));
Expand All @@ -58,5 +58,3 @@ struct conv3d_driver : conv_driver<T, ConvApi::Immediate>
this->add(this->out_layout, "out_layout", this->generate_data({"NCDHW"}));
}
};

int main(int argc, const char* argv[]) { test_drive<conv3d_driver>(argc, argv); }
7 changes: 6 additions & 1 deletion test/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,11 @@ void test_drive_impl_1(std::string program_name, std::vector<std::string> as)
Driver d{};
d.program_name = program_name;

std::cout << program_name << " ";
for(const auto& str : as)
std::cout << str << " ";
std::cout << std::endl;

std::set<std::string> keywords{
"--help", "-h", "--half", "--float", "--double", "--int8", "--bfloat16"};
d.parse(keyword_set{keywords});
Expand Down Expand Up @@ -1381,7 +1386,7 @@ template <template <class...> class Driver>
void test_drive(int argc, const char* argv[])
{
std::vector<std::string> as(argv + 1, argv + argc);
as.emplace_back("--float");
// as.emplace_back("--float");
for(auto&& arg : as)
{
if(arg == "--half")
Expand Down
2 changes: 1 addition & 1 deletion test/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(add_gtest TEST_NAME)
endif()
if(NOT WIN32) # TODO: cannot run on Windows due to missing DLL dependencies
# Enable CMake to discover the test binary
gtest_discover_tests(test_${TEST_NAME} PROPERTIES ENVIRONMENT "MIOPEN_USER_DB_PATH=${CMAKE_CURRENT_BINARY_DIR};MIOPEN_TEST_FLOAT_ARG=${MIOPEN_TEST_FLOAT_ARG};MIOPEN_TEST_ALL=${MIOPEN_TEST_ALL};MIOPEN_TEST_MLIR=${MIOPEN_TEST_MLIR};MIOPEN_TEST_COMPOSABLEKERNEL=${MIOPEN_TEST_COMPOSABLEKERNEL}")
gtest_discover_tests(test_${TEST_NAME} PROPERTIES ENVIRONMENT "MIOPEN_USER_DB_PATH=${CMAKE_CURRENT_BINARY_DIR};MIOPEN_TEST_FLOAT_ARG=${MIOPEN_TEST_FLOAT_ARG};MIOPEN_TEST_ALL=${MIOPEN_TEST_ALL};MIOPEN_TEST_MLIR=${MIOPEN_TEST_MLIR};MIOPEN_TEST_COMPOSABLEKERNEL=${MIOPEN_TEST_COMPOSABLEKERNEL};CODECOV_TEST=${CODECOV_TEST}")
endif()

if(WIN32)
Expand Down
172 changes: 172 additions & 0 deletions test/gtest/conv3d_codecov.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 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
* 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.
*
*******************************************************************************/
#include "conv3d.hpp"
#include "get_handle.hpp"
#include <miopen/env.hpp>
#include <gtest/gtest.h>

MIOPEN_DECLARE_ENV_VAR_BOOL(CODECOV_TEST)
MIOPEN_DECLARE_ENV_VAR_STR(MIOPEN_TEST_FLAGS_ARGS)

static bool SkipTest(void) { return !miopen::IsEnabled(ENV(CODECOV_TEST)); }

void GetArgs(const std::string& param, std::vector<std::string>& tokens)
{
std::stringstream ss(param);
std::istream_iterator<std::string> begin(ss);
std::istream_iterator<std::string> end;
while(begin != end)
tokens.push_back(*begin++);
}

class Conv3dFloat : public testing::TestWithParam<std::vector<std::string>>
{
};

class Conv3dHalf : public testing::TestWithParam<std::vector<std::string>>
{
};

class Conv3dBFloat16 : public testing::TestWithParam<std::vector<std::string>>
{
};

class Conv3dInt8 : public testing::TestWithParam<std::vector<std::string>>
{
};

void Run3dDriver(miopenDataType_t prec)
{

std::vector<std::string> params;
switch(prec)
{
case miopenHalf: params = Conv3dHalf::GetParam(); break;
case miopenBFloat16: params = Conv3dBFloat16::GetParam(); break;
case miopenFloat: params = Conv3dFloat::GetParam(); break;
case miopenInt8: params = Conv3dInt8::GetParam(); break;
case miopenFloat8:
case miopenBFloat8:
case miopenInt32:
case miopenDouble:
FAIL() << "miopenInt32, miopenDouble, miopenFloat8, miopenBFloat8 "
"data type not supported by "
"conv3d_codecov test";

default: params = Conv3dFloat::GetParam();
}

for(const auto& test_value : params)
{
std::vector<std::string> tokens;
GetArgs(test_value, tokens);
std::vector<const char*> ptrs;

std::transform(tokens.begin(), tokens.end(), std::back_inserter(ptrs), [](const auto& str) {
return str.data();
});

testing::internal::CaptureStderr();
test_drive<conv3d_driver>(ptrs.size(), ptrs.data());
auto capture = testing::internal::GetCapturedStderr();
std::cout << capture;
}
};

bool IsTestSupportedForDevice(const miopen::Handle& handle) { return true; }

TEST_P(Conv3dFloat, FloatTest)
{
const auto& handle = get_handle();
if(IsTestSupportedForDevice(handle) && !SkipTest())
{
Run3dDriver(miopenFloat);
}
else
{
GTEST_SKIP();
}
};

TEST_P(Conv3dHalf, HalfTest)
{
const auto& handle = get_handle();
if(IsTestSupportedForDevice(handle) && !SkipTest())
{
Run3dDriver(miopenHalf);
}
else
{
GTEST_SKIP();
}
};

TEST_P(Conv3dBFloat16, BFloat16Test)
{
const auto& handle = get_handle();
if(IsTestSupportedForDevice(handle) && !SkipTest())
{
Run3dDriver(miopenBFloat16);
}
else
{
GTEST_SKIP();
}
};

TEST_P(Conv3dInt8, Int8Test)
{
const auto& handle = get_handle();
if(IsTestSupportedForDevice(handle) && !SkipTest())
{
Run3dDriver(miopenInt8);
}
else
{
GTEST_SKIP();
}
};

std::vector<std::string> GetTestCases(const std::string& precision)
{
const auto& flag_arg = miopen::GetStringEnv(ENV(MIOPEN_TEST_FLAGS_ARGS));

const std::vector<std::string> test_cases = {
// clang-format off
{"test_conv3d " + precision + " --input 2 4 4 4 4 --weights 2 4 1 1 1 --pads_strides_dilations 0 0 0 1 1 1 1 1 1 "+flag_arg}
// clang-format on
};

return test_cases;
}

INSTANTIATE_TEST_SUITE_P(Conv3D, Conv3dFloat, testing::Values(GetTestCases("--float")));

INSTANTIATE_TEST_SUITE_P(Conv3D, Conv3dHalf, testing::Values(GetTestCases("--half")));

INSTANTIATE_TEST_SUITE_P(Conv3D, Conv3dBFloat16, testing::Values(GetTestCases("--bfloat16")));

INSTANTIATE_TEST_SUITE_P(Conv3D, Conv3dInt8, testing::Values(GetTestCases("--int8")));
66 changes: 0 additions & 66 deletions test/gtest/conv_2d.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion test/gtest/conv_igemm_mlir_xdlops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <gtest/gtest.h>
#include <miopen/miopen.h>
#include <miopen/env.hpp>
#include "conv_2d.hpp"
#include "conv2d.hpp"
#include "get_handle.hpp"

MIOPEN_DECLARE_ENV_VAR_STR(MIOPEN_TEST_FLOAT_ARG)
Expand Down
Loading

0 comments on commit ed002f5

Please sign in to comment.