From 66afb96231bd6cec9b389ca53c8e5450b1d2d23d Mon Sep 17 00:00:00 2001 From: Jorge Pineda Date: Fri, 12 Apr 2024 15:38:40 -0700 Subject: [PATCH] [ET-VK][EZ] Throw in VK_GET_OP_FN if op is not found Make @yipjustin happy. Forgot this safeguard when I originally wrote the `OperatorRegistry` class. Differential Revision: [D56085588](https://our.internmc.facebook.com/intern/diff/D56085588/) [ghstack-poisoned] --- backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp b/backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp index 449c31508a5..4d1f749830c 100644 --- a/backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp +++ b/backends/vulkan/runtime/graph/ops/OperatorRegistry.cpp @@ -16,7 +16,9 @@ bool OperatorRegistry::has_op(const std::string& name) { OperatorRegistry::OpFunction& OperatorRegistry::get_op_fn( const std::string& name) { - return table_.find(name)->second; + const auto it = table_.find(name); + VK_CHECK_COND(it != table_.end(), "Could not find operator with name ", name); + return it->second; } void OperatorRegistry::register_op(const std::string& name, OpFunction& fn) {