You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tvm.apache.org by Aditya via Apache TVM Discuss <no...@discuss.tvm.ai> on 2020/09/16 10:09:47 UTC

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context


We have a custom accelerator that uses the OpenCL frontend. We want to include this as a custom type like the aocl within the TVM pipeline. How do we go about introducing a new target for the same? (we aim to give our custom accelerator as the target parameter for tvm.context)





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/1) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/53879bd1a7b4fce9e6ce61ebe3f1837c3d707b130d16bfdbb94d5a5e026b7c8d).

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context

Posted by Akhil via Apache TVM Discuss <no...@discuss.tvm.ai>.

Hey @comaniac and @junrushao1994 seems like I just messed up the names inside the cmake/modules/opencl.cmake file





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/7) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/79cd995d2286d5ca84f7d8fed90f2ad0a40ccf23d776585a4bd8b927b9ca951d).

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context

Posted by Junru Shao via Apache TVM Discuss <no...@discuss.tvm.ai>.

I saw FunctionInfo in the unmangled symbol name, so it looks like there are some missing pieces in the build. Seems like some linking issues or some symbols are missing.

Is it working if you build on HEAD?





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/6) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/399c47408120dd35c5a3a17927992a1eaf2603a0fb4a0423f955b83830a33c01).

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context

Posted by "Cody H. Yu via Apache TVM Discuss" <no...@discuss.tvm.ai>.

@junrushao1994 do you have an idea for this error before diving into it?





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/5) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/3d6b43bbeba9ecdded1a126a5e112411b5d570de8bcfd79bc0752dea7a800dd4).

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context

Posted by Akhil via Apache TVM Discuss <no...@discuss.tvm.ai>.

[quote="comaniac, post:2, topic:7925"]
`https://github.com/apache/incubator-tvm/blob/master/src/target/target_kind.cc` .
[/quote]

Also Once I added the files for for my new target called rsim I got the folowing error

>  File "sample_gpu.py", line 1, in <module>
>     import tvm
>   File "/home/akhil/Downloads/TVM/tvm/python/tvm/__init__.py", line 25, in <module>
>     from ._ffi.base import TVMError, __version__
>   File "/home/akhil/Downloads/TVM/tvm/python/tvm/_ffi/__init__.py", line 28, in <module>
>     from .base import register_error
>   File "/home/akhil/Downloads/TVM/tvm/python/tvm/_ffi/base.py", line 62, in <module>
>     _LIB, _LIB_NAME = _load_lib()
>   File "/home/akhil/Downloads/TVM/tvm/python/tvm/_ffi/base.py", line 50, in _load_lib
>     lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_GLOBAL)
>   File "/usr/lib/python3.6/ctypes/__init__.py", line 348, in __init__
>     self._handle = _dlopen(self._name, mode)
> OSError: /home/akhil/Downloads/TVM/tvm/build/libtvm.so: undefined symbol: _ZN3tvm7runtime16RSIMModuleCreateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_St13unordered_mapIS6_NS0_12FunctionInfoESt4hashIS6_ESt8equal_toIS6_ESaISt4pairIKS6_S8_EEES6_





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/4) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/7d8a11a85552a2006b6c844fb32790fc0fb8a59617f056aa6d80198e9b1068f2).

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context

Posted by Akhil via Apache TVM Discuss <no...@discuss.tvm.ai>.

Hey @comaniac Thanks that was helpful. So if i register a new target "newName" for example like

> TVM_REGISTER_TARGET_KIND("newName")

>     .add_attr_option<Array<String>>("keys")
>     .add_attr_option<Array<String>>("libs")
>     .add_attr_option<String>("device")
>     .add_attr_option<String>("model")
>     .add_attr_option<Bool>("system-lib")
>     .add_attr_option<Integer>("max_num_threads", Integer(256))
>     .add_attr_option<Integer>("thread_warp_size")
>     .set_default_keys({"opencl", "accelerator"})
>     .set_device_type(kDLOpenCL);

when I call tvm.context("newName") now will it directly use opencl backend or am I supposed to add more files for newName in the src/runtime folder ?





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/3) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/8740f7a67265d7aeba86de586107f79c58294c607f015f770fd2c8465cfe531a).

[Apache TVM Discuss] [Development/RFC] Append a custom target for TVM Context

Posted by "Cody H. Yu via Apache TVM Discuss" <no...@discuss.tvm.ai>.

You can first register a target using `TVM_REGISTER_TARGET_KIND` macro in `https://github.com/apache/incubator-tvm/blob/master/src/target/target_kind.cc`. Then register OpenCL codegen as your backend.

This doc can help you get familiar with the compilation flow, and you can add corresponding compoents for your accelerator:

https://tvm.apache.org/docs/dev/codebase_walkthrough.html





---
[Visit Topic](https://discuss.tvm.apache.org/t/append-a-custom-target-for-tvm-context/7925/2) to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click here](https://discuss.tvm.apache.org/email/unsubscribe/534197a40fe59fe30d63ea7fefebbdaa39092cbaa51e84318b5f0551b527e900).