Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amberhassaan committed Dec 18, 2023
1 parent f5b1667 commit e726221
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
25 changes: 12 additions & 13 deletions src/fusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ AllocateBuffersAndMakeFusionInvokeParams(Handle& handle,
const auto bn_inf_id = solver::fusion::GetOpIdx(plan.op_map, miopenFusionOpBatchNormInference);
const auto bn_fwd_id = solver::fusion::GetOpIdx(plan.op_map, miopenFusionOpBatchNormFwdTrain);
const auto bn_bwd_id = solver::fusion::GetOpIdx(plan.op_map, miopenFusionOpBatchNormBwdTrain);
const auto tensor_add_op_id = solver::fusion::GetOpIdx(plan.op_map, miopenFusionOpTensorScaleAdd);
const auto tensor_add_op_id =
solver::fusion::GetOpIdx(plan.op_map, miopenFusionOpTensorScaleAdd);

const auto any_activ = activ_fwd_id != -1 || activ_bwd_id != -1;
const auto any_bn = bn_inf_id != -1 || bn_fwd_id != -1 || bn_bwd_id != -1;
Expand Down Expand Up @@ -219,20 +220,18 @@ AllocateBuffersAndMakeFusionInvokeParams(Handle& handle,
}
}

if (tensor_add_op_id != -1) {
const auto& tensor_add_op = dynamic_cast<const TensorScaleAddOpDescriptor&>
(*plan.op_map[tensor_add_op_id]);
assert(&tensor_add_op);

float alpha = 1.0f;
const auto space = tensor_add_op.tensor_desc.GetNumBytes();
auto ptr = allocate_buffer(space);
if(tensor_add_op_id != -1)
{
const auto& tensor_add_op =
dynamic_cast<const TensorScaleAddOpDescriptor&>(*plan.op_map[tensor_add_op_id]);
assert(&tensor_add_op);

params.SetArg(tensor_add_op_id,
std::make_unique<miopen::fusion::TensorScaleAddOpInvokeParam>(
alpha, ptr));
float alpha = 1.0f;
const auto space = tensor_add_op.tensor_desc.GetNumBytes();
auto ptr = allocate_buffer(space);


params.SetArg(tensor_add_op_id,
std::make_unique<miopen::fusion::TensorScaleAddOpInvokeParam>(alpha, ptr));
}

if(any_bn)
Expand Down
27 changes: 14 additions & 13 deletions test/gtest/fused_conv_bias_res_add_activ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@
// namespace conv_bias_act_res_add_fwd {

std::vector<Conv3DTestCase> ConvTestConfigs()
{ // g, n, c, d, h, w, k, z, y, x, pad_x pad_y pad_z stri_x stri_y stri_z dia_x dia_y dia_z
return {{1, 1, 4, 14, 11, 1, 4, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{1, 1, 1, 1, 4, 4, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{1, 1, 1, 8, 8, 8, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 1, miopenConvolution},
{1, 1, 1, 8, 8, 8, 1, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1, 1, 1, miopenConvolution},
{2, 8, 8, 12, 14, 4, 4, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{4, 8, 8,11, 11, 11,16, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{6, 8, 18,11, 11, 11,18, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{8, 8, 8, 11, 11, 11,8, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{4, 8, 4, 11, 11, 11,8, 3, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{2, 8, 2, 11, 11, 11,2, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution}};
{ // g, n, c, d, h, w, k, z, y, x, pad_x pad_y pad_z stri_x stri_y stri_z dia_x dia_y
// dia_z
return {{1, 1, 4, 14, 11, 1, 4, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{1, 1, 1, 1, 4, 4, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{1, 1, 1, 8, 8, 8, 1, 2, 2, 2, 0, 0, 0, 1, 1, 1, 1, 1, 1, miopenConvolution},
{1, 1, 1, 8, 8, 8, 1, 2, 2, 2, 0, 0, 0, 2, 2, 2, 1, 1, 1, miopenConvolution},
{2, 8, 8, 12, 14, 4, 4, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{4, 8, 8, 11, 11, 11, 16, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{6, 8, 18, 11, 11, 11, 18, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{8, 8, 8, 11, 11, 11, 8, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{4, 8, 4, 11, 11, 11, 8, 3, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution},
{2, 8, 2, 11, 11, 11, 2, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, miopenConvolution}};
}

template <typename T = float>
Expand All @@ -60,8 +61,8 @@ struct ConvFwdBiasResAddFixture

std::tie(algo, conv_config, alpha1, alpha2, tensor_layout) = GetParam();

input = tensor<T>{tensor_layout, conv_config.GetInput()};
weights = tensor<T>{tensor_layout, conv_config.GetWeights()};
input = tensor<T>{tensor_layout, conv_config.GetInput()};
weights = tensor<T>{tensor_layout, conv_config.GetWeights()};
auto gen_value = [](auto...) {
return prng::gen_A_to_B(static_cast<T>(-3.0), static_cast<T>(3.0));
};
Expand Down

0 comments on commit e726221

Please sign in to comment.