1# Licensed to the Apache Software Foundation (ASF) under one 2# or more contributor license agreements. See the NOTICE file 3# distributed with this work for additional information 4# regarding copyright ownership. The ASF licenses this file 5# to you under the Apache License, Version 2.0 (the 6# "License"); you may not use this file except in compliance 7# with the License. You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, 12# software distributed under the License is distributed on an 13# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14# KIND, either express or implied. See the License for the 15# specific language governing permissions and limitations 16# under the License. 17"""Common utility for topi test""" 18 19from tvm import autotvm 20from tvm.autotvm.task.space import FallbackConfigEntity 21 22 23def get_all_backend(): 24 """return all supported target 25 26 Returns 27 ------- 28 targets: list 29 A list of all supported targets 30 """ 31 return ['llvm', 'cuda', 'opencl', 'metal', 'rocm', 'vulkan', 'nvptx', 32 'llvm -device=arm_cpu', 'opencl -device=mali', 'aocl_sw_emu'] 33 34 35class Int8Fallback(autotvm.FallbackContext): 36 def _query_inside(self, target, workload): 37 key = (target, workload) 38 if key in self.memory: 39 return self.memory[key] 40 cfg = FallbackConfigEntity() 41 cfg.template_key = 'int8' 42 self.memory[key] = cfg 43 cfg.is_fallback = False 44 return cfg 45