|
| 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 | +"""CLML compiler tests.""" |
| 18 | + |
| 19 | +import tvm |
| 20 | +import numpy as np |
| 21 | +from tvm import relay |
| 22 | +from tvm.relay import testing |
| 23 | +from tvm.relay.op.contrib import clml |
| 24 | +import pytest |
| 25 | + |
| 26 | + |
| 27 | +@tvm.testing.requires_openclml |
| 28 | +def test_device_annotation(): |
| 29 | + mod, params = relay.testing.mobilenet.get_workload(batch_size=1) |
| 30 | + mod = clml.partition_for_clml(mod, params) |
| 31 | + with tvm.transform.PassContext(opt_level=3): |
| 32 | + relay.backend.te_compiler.get().clear() |
| 33 | + lib = relay.build( |
| 34 | + mod, |
| 35 | + target="opencl -device=adreno", |
| 36 | + target_host="llvm -mtriple=aarch64-linux-gnu", |
| 37 | + params=params |
| 38 | + ) |
| 39 | + |
| 40 | +if __name__ == "__main__": |
| 41 | + tvm.testing.main() |
0 commit comments