Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ OpBuilderRegistrations::OpBuilderRegistrations() {
CreateSimpleOpBuilder("Elu", *this);
CreateSimpleOpBuilder("Round", *this);
CreateSimpleOpBuilder("Where", *this);
CreateSimpleOpBuilder("ScatterND", *this);
CreateSimpleOpBuilder("Sigmoid", *this);
CreateSimpleOpBuilder("Sin", *this);
CreateSimpleOpBuilder("Sqrt", *this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ class BaseOpBuilder : public IOpBuilder {
{"ReduceSum", QNN_OP_REDUCE_SUM},
{"Round", QNN_OP_ELEMENT_WISE_ROUND},
{"Where", QNN_OP_ELEMENT_WISE_SELECT},
{"ScatterND", QNN_OP_SCATTER_ND},
{"Sigmoid", QNN_OP_SIGMOID},
{"Sin", QNN_OP_ELEMENT_WISE_SIN},
{"Slice", QNN_OP_STRIDED_SLICE},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ Status SimpleOpBuilder::ExplicitOpCheck(QnnModelWrapper& qnn_model_wrapper,
padding_mode.c_str());
}

// To DO: Remove once QNN CPU supports ScatterND
const auto qnn_backend_type = qnn_model_wrapper.GetQnnBackendType();
if (op_type == "ScatterND") {
ORT_RETURN_IF_NOT(qnn_backend_type == QnnBackendType::HTP,
"QNN EP only supports ScatterND op on HTP backend. Falling back to ORT CPU.");
}

// ONNX's Min, Max, and Sum operators accept a variable number of inputs (i.e., variadic).
// However, QNN's Min, Max, and Add operators must take in exactly two inputs.
if (op_type == "Min" || op_type == "Max") {
Expand Down
16 changes: 16 additions & 0 deletions onnxruntime/test/providers/qnn/simple_op_htp_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,22 @@ TEST_F(QnnHTPBackendTests, BinaryOp_And4D) {
ExpectedEPNodeAssignment::All);
}

// Test ScatterND op on HTP
TEST_F(QnnHTPBackendTests, ScatterND_int64_int64) {
std::vector<int64_t> data = {0, 1, 2, 3};
std::vector<int64_t> indices = {1};
std::vector<int64_t> updates = {10};
RunOpTest<int64_t>("ScatterND",
{
TestInputDef<int64_t>({4}, false, std::move(data)),
TestInputDef<int64_t>({1, 1}, false, std::move(indices)),
TestInputDef<int64_t>({1}, false, std::move(updates)),
},
{},
17,
ExpectedEPNodeAssignment::All);
}

// Test that Or is not yet supported on CPU backend.
TEST_F(QnnHTPBackendTests, BinaryOp_HTP_Or_Unsupported) {
RunOpTest<bool>("Or",
Expand Down
Loading