diff --git a/ethosu/regor/compiler/scheduler_packing.cpp b/ethosu/regor/compiler/scheduler_packing.cpp index a8e19b0e5b76ffc8bbd1ee735f6422d694255353..9d0e651cc6e3baf7da28e26c4bc82ef1ecaa384d 100644 --- a/ethosu/regor/compiler/scheduler_packing.cpp +++ b/ethosu/regor/compiler/scheduler_packing.cpp @@ -295,14 +295,17 @@ void SchedulerPacking::PrePackOperations() ArchRequirements oReq{}; Flags result = OperatorQuery(_arch, schedOp.get(), &oReq); assert(result.Any(QueryResult::Constrained) == false && "Constrained result from complete OperatorQuery"); - // Determine if each operation can run on NPU - if ( result.Any(QueryResult::Native) ) + if ( schedOp->Type() == OpType::Passthrough ) + { + schedOp->SetNpuOp(false); + } + else if ( result.Any(QueryResult::Native) ) { // TODO MLBEDSW-10643: This should be a direct-check against QueryResult::Native - // HasRequirements at this point should result in CPU-fallback + // HasRequirements at this point should result in failure if ( result.Any(QueryResult::HasRequirements) && oReq.req.Any(ArchRequirement::Decompose) ) { - schedOp->SetNpuOp(false); + throw std::runtime_error("Non-passthrough operation could not run on NPU."); } else { @@ -311,7 +314,7 @@ void SchedulerPacking::PrePackOperations() } else { - schedOp->SetNpuOp(false); + throw std::runtime_error("Non-passthrough operation could not run on NPU."); } // Examine elementwise and set a primary path for cascading. diff --git a/ethosu/regor/test/test_scheduler_packing.cpp b/ethosu/regor/test/test_scheduler_packing.cpp index 10656127a4bd7bbb6188631dd2a34cefb446c52c..3bf954c5283871ecb9375cf3b0ea9dcf4a8b8507 100644 --- a/ethosu/regor/test/test_scheduler_packing.cpp +++ b/ethosu/regor/test/test_scheduler_packing.cpp @@ -1,5 +1,5 @@ // -// SPDX-FileCopyrightText: Copyright 2024 Arm Limited and/or its affiliates +// SPDX-FileCopyrightText: Copyright 2024-2025 Arm Limited and/or its affiliates // // SPDX-License-Identifier: Apache-2.0 // @@ -46,7 +46,7 @@ TEST_CASE("test_scheduler_packing") // Validate that attr_axis still represents the reduced axis. std::vector> ops; auto ifm = CreateTensor("IFM", Shape(10, 10), DataType::Int8); - auto ofm = CreateTensor("OFM", Shape(1, 10), DataType::Int8); + auto ofm = CreateTensor("OFM", Shape(1, 10), DataType::Int32); auto op = CreateOperation(OpType::ArgMax, TensorUsage::IFM, ifm, TensorUsage::OFM, ofm); auto attr = op->Attribute(); attr->axis = 0; @@ -79,7 +79,7 @@ TEST_CASE("test_scheduler_packing") // Validate that attr_axis still represent the reduced axes. std::vector> ops; auto ifm = CreateTensor("IFM", Shape(10, 10, 10), DataType::Int8); - auto ofm = CreateTensor("OFM", Shape(10, 2, 10), DataType::Int8); + auto ofm = CreateTensor("OFM", Shape(10, 2, 10), DataType::Int32); // first op // reads 0,0,0 - shape 10,5,10