diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchError.h b/extension/apple/ExecuTorch/Exported/ExecuTorchError.h index 6a8ab7bc2fc..e53908687b0 100644 --- a/extension/apple/ExecuTorch/Exported/ExecuTorchError.h +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchError.h @@ -19,30 +19,34 @@ FOUNDATION_EXPORT NSErrorDomain const ExecuTorchErrorDomain NS_SWIFT_NAME(ErrorD */ typedef NS_ERROR_ENUM(ExecuTorchErrorDomain, ExecuTorchErrorCode) { // System errors. - ExecuTorchErrorCodeOk = 0, - ExecuTorchErrorCodeInternal = 1, - ExecuTorchErrorCodeInvalidState = 2, - ExecuTorchErrorCodeEndOfMethod = 3, + ExecuTorchErrorCodeOk = 0, + ExecuTorchErrorCodeInternal = 1, + ExecuTorchErrorCodeInvalidState = 2, + ExecuTorchErrorCodeEndOfMethod = 3, // Logical errors. - ExecuTorchErrorCodeNotSupported = 16, - ExecuTorchErrorCodeNotImplemented = 17, - ExecuTorchErrorCodeInvalidArgument = 18, - ExecuTorchErrorCodeInvalidType = 19, - ExecuTorchErrorCodeOperatorMissing = 20, + ExecuTorchErrorCodeNotSupported = 16, + ExecuTorchErrorCodeNotImplemented = 17, + ExecuTorchErrorCodeInvalidArgument = 18, + ExecuTorchErrorCodeInvalidType = 19, + ExecuTorchErrorCodeOperatorMissing = 20, + + // Registration errors. + ExecuTorchErrorCodeRegistrationExceedingMaxKernels = 21, + ExecuTorchErrorCodeRegistrationAlreadyRegistered = 22, // Resource errors. - ExecuTorchErrorCodeNotFound = 32, - ExecuTorchErrorCodeMemoryAllocationFailed = 33, - ExecuTorchErrorCodeAccessFailed = 34, - ExecuTorchErrorCodeInvalidProgram = 35, - ExecuTorchErrorCodeInvalidExternalData = 36, - ExecuTorchErrorCodeOutOfResources = 37, + ExecuTorchErrorCodeNotFound = 32, + ExecuTorchErrorCodeMemoryAllocationFailed = 33, + ExecuTorchErrorCodeAccessFailed = 34, + ExecuTorchErrorCodeInvalidProgram = 35, + ExecuTorchErrorCodeInvalidExternalData = 36, + ExecuTorchErrorCodeOutOfResources = 37, // Delegate errors. - ExecuTorchErrorCodeDelegateInvalidCompatibility = 48, - ExecuTorchErrorCodeDelegateMemoryAllocationFailed = 49, - ExecuTorchErrorCodeDelegateInvalidHandle = 50, + ExecuTorchErrorCodeDelegateInvalidCompatibility = 48, + ExecuTorchErrorCodeDelegateMemoryAllocationFailed = 49, + ExecuTorchErrorCodeDelegateInvalidHandle = 50, } NS_SWIFT_NAME(ErrorCode); /** diff --git a/extension/apple/ExecuTorch/Exported/ExecuTorchError.m b/extension/apple/ExecuTorch/Exported/ExecuTorchError.m index 20b3af2e349..26929554bf7 100644 --- a/extension/apple/ExecuTorch/Exported/ExecuTorchError.m +++ b/extension/apple/ExecuTorch/Exported/ExecuTorchError.m @@ -30,6 +30,10 @@ return @"Invalid type"; case ExecuTorchErrorCodeOperatorMissing: return @"Operator missing"; + case ExecuTorchErrorCodeRegistrationExceedingMaxKernels: + return @"Exceeded maximum number of kernels"; + case ExecuTorchErrorCodeRegistrationAlreadyRegistered: + return @"Kernel is already registered"; case ExecuTorchErrorCodeNotFound: return @"Resource not found"; case ExecuTorchErrorCodeMemoryAllocationFailed: