Skip to content

No valid engine configs for NCHW sigmoid #171

@swimvtec

Description

@swimvtec

Describe the bug
No valid engine configuration is found for a simple sigmoid activation with NCHW layout. Works with the legacy API.

Expected behavior
Simple graphs just work. No need to convert tensor shapes.

System Environment (please complete the following information):

  • cudnn_frontend version: 1.12
  • cudnn_backend version: 9.11
  • GPU arch: RTX A2000
  • cuda runtime version: 12.8
  • cuda driver version: 570.172.08
  • host compiler: clang19
  • OS: ubuntu22.04

API logs
API logs are attached:

be.log
fe.log

To Reproduce

static void SetTensorShape(
    std::shared_ptr<cudnn_frontend::graph::Tensor_attributes>& tensor,
    Shape const&                                               shape)
{
  tensor->set_dim({shape.batch_size, shape.depth, shape.height, shape.width})
      .set_stride({shape.height * shape.width * shape.depth,
                   shape.height * shape.width, shape.width, 1});
}

static std::shared_ptr<cudnn_frontend::graph::Tensor_attributes>
TensorFromShape(cudnn_frontend::graph::Graph* graph, Shape const& shape,
                std::string const& name)
{
  namespace fe = cudnn_frontend;

  std::shared_ptr<fe::graph::Tensor_attributes> tensor =
      graph->tensor(fe::graph::Tensor_attributes().set_name(name));

  SetTensorShape(tensor, shape);

  return tensor;
}

TEST(Sigmoid, Small)
{
  ... code to get cudnn handle ...

  namespace fe                = cudnn_frontend;
  auto              fwd_graph = std::make_unique<fe::graph::Graph>();
  fe::graph::Graph* graph     = fwd_graph.get();

  graph->set_io_data_type(fe::DataType_t::FLOAT)
      .set_compute_data_type(fe::DataType_t::FLOAT)
      .set_intermediate_data_type(fe::DataType_t::FLOAT);

  Shape input_shape{2, 1, 1, 2};

  auto tensor_x = TensorFromShape(graph, input_shape, "input");

    auto pointwise_attribs =
      fe::graph::Pointwise_attributes().set_compute_data_type(
          fe::DataType_t::FLOAT).set_mode(fe::PointwiseMode_t::SIGMOID_FWD);
  auto tensor_y = graph->pointwise(tensor_x, pointwise_attribs);

  SetTensorShape(tensor_y, input_shape);
  tensor_y->set_output(true);

  if (auto err = graph->validate(); err.is_bad())
  {
    GTEST_FAIL();
  }
  if (auto err = graph->build_operation_graph(cudnn_handle); err.is_bad())
  {
    GTEST_FAIL();
  }

  if (auto err = graph->create_execution_plans(
          {fe::HeurMode_t::B, fe::HeurMode_t::FALLBACK});
      err.is_bad())
  {
    GTEST_FAIL();
  }
}

Additional context
Does not work with NHWC layout as well. Seems to work reliably with 3 dimensional tensors only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions