1// Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15namespace tflite.acceleration; 16 17enum Comparison : byte { 18 EQUAL = 0, 19 MINIMUM = 1, 20} 21 22// Mapping from available device features to compatibility decisions. Basic usage is to: 23// 1) Map easily available device data (like Android version, 24// Manufacturer, Device) to things like SoC vendor, SoC model. 25// 2) Map complete device data to delegate-specific features and support status 26// 3) Map delegate-specific features to delegate configuration. 27// 28// The structure describes a decision tree, with multiple matching branches. 29// The branches are applied depth-first. 30table DeviceDatabase { 31 root:[DeviceDecisionTreeNode]; 32} 33 34table DeviceDecisionTreeNode { 35 // The variables are strings, as we have multiple clients that want to 36 // introduce their own fields. Known variables are listed in variables.h. 37 variable:string (shared); 38 comparison:Comparison; 39 items:[DeviceDecisionTreeEdge]; 40} 41 42table DeviceDecisionTreeEdge { 43 // Under which variable value does this item match. 44 value:string (key, shared); 45 // Which child branches should also be consulted and used to override this 46 // node. 47 children:[DeviceDecisionTreeNode]; 48 // What information can be derived about this device. 49 derived_properties:[DerivedProperty]; 50} 51 52// Derived variable value to combine with detected variables. 53table DerivedProperty { 54 variable:string (shared); 55 value:string (shared); 56} 57 58root_type DeviceDatabase; 59