common.py 735 Bytes
Newer Older
1 2
"""Common utility for topi test"""

3 4 5 6
from tvm import autotvm
from tvm.autotvm.task.space import FallbackConfigEntity


7 8 9 10 11 12 13 14 15
def get_all_backend():
    """return all supported target

    Returns
    -------
    targets: list
        A list of all supported targets
    """
    return ['llvm', 'cuda', 'opencl', 'metal', 'rocm', 'vulkan', 'nvptx',
16
            'llvm -device=arm_cpu', 'opencl -device=mali', 'aocl_sw_emu']
17 18 19 20 21 22 23 24 25 26 27


class NCHWcInt8Fallback(autotvm.FallbackContext):
    def _query_inside(self, target, workload):
        key = (target, workload)
        if key in self.memory:
            return self.memory[key]
        cfg = FallbackConfigEntity()
        cfg.template_key = 'int8'
        self.memory[key] = cfg
        return cfg