You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by Akhil via Apache TVM Discuss <no...@discuss.tvm.ai> on 2020/09/06 14:08:34 UTC

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator


So I am using device accelerator which uses opencl (pocl). Here when I try to run opencl code using tvm on this device I have to fetch the context here as tvm.cl() but it does not use the device type as accelerator unless I set the dtype  = CL_DEVICE_TYPE_ACCELERATOR, in the tvm/src/runtime/opencl/opencl_device_api.cc

So how do I set the dtype as accelerator without explicitly setting the dtype in the opencl_device_api.ccm which function takes these parameters and which files can I go through to find out how these parameters are set

([https://discuss.tvm.apache.org/t/how-does-tvm-choose-the-platform-and-device/7695/5?u=akhilj99](https://discuss.tvm.apache.org/t/how-does-tvm-choose-the-platform-and-device/7695/5?u=akhilj99))





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/7895854d29ad15de4b4e396178e4856b095d7294d3bc423a7047e10764608f6a).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

 I tried to use the same system as what was already present but I agree that this system is not of high quality.

In my opinion it will benefit greatly from an overhaul that let the user specify which device type to use, so feel free to submit a pull request if you implement it. However I recommend you check with @tqchen or @kazum as they worked on this part before.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/3f19331ee4e9bf3bfbd8d29ab67a5182cda214fee4d0d3628fbe59ea8660f31e).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

Hey @aurel333 Thanks a ton for that fix. The update you have given will try choose the first platform even if couldn't find an accelerator device. Would it be better to continue and check the next platform instead of trying to change the device_type and look for devices ?





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/c3a4aeb2ba0cbbfbcd28874186934e3d298c057c779e680c3d7a12e5cea3f3d9).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

I made the pull request [#6412](https://github.com/apache/incubator-tvm/pull/6412). It may not be perfect but it should help you for your project.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/66316a8dceec914fc2b45474c22d553eb8ce44f1c5bcf5089f024749da7ffa31).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

Hello, I made TVM work with OpenCL accelerators and I am preparing a pull request to make TVM accept opencl accelerator device type along with some modifications in the opencl default schedules to generalize them. I will post further updates here.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/4823885fdff9ae6bc63dda419f0b94da2ce0e5ac3880e93c29fbea5f411905af).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

Hey @FrozenGene

 Could you point me to some documentation on AOCL is intoduces as a device type.
Also in the aocl folder inside src/runtime/opencl/aocl/aocl_device_api.cc , how exactly is aocl choosing a device as it is not looking through all the platforms as opencl is ?





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/8) 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/a63cf102aac9ccad71d7b7a10c18a48af14b65b488b29f6dcd2d3e4db4eec44c).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

The problem is in
```cpp
  void Init(const std::string& type_key, const std::string& device_type,
            const std::string& platform_name = "");
  virtual void Init() { Init("opencl", "gpu"); } // gpu is the device type
``` 

Inside `Init`, we will only try to match the `gpu` device type, if no, we will use opencl cpu.

For your case, I would suggest we create one new DeviceType (although you are using OpenCL, but you are an accelerator), you could refer how `AOCL` (Intel FPGA which uses OpenCL) to do, your case is almost the same as them.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/cd6a368c0d65f2151849406537839eb6726ff1e492b4200d449af9e990fd6881).

[Apache TVM Discuss] [Questions] TVM opencl context how to choose device type as accelerator

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

cc @FrozenGene, who may have more experiences on OpenCL.





---
[Visit Topic](https://discuss.tvm.apache.org/t/tvm-opencl-context-how-to-choose-device-type-as-accelerator/7821/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/01061cfaefd57a8130b13b85b4e4d1e092882d5fdec664fb79fb9e8e3adbab92).