What is the meaning of tvm.cpu(0) and tvm.cpu(1)?

Hello TVM developers and community,

I have seen tvm.cpu() in tvm.runtime document.

I wondering what is the difference when calling tvm.cpu(0) and tvm.cpu(1)

For example, I am using Hikey970 which contains 4 ARM-A53 LITTLE cores and 4 ARM-A73 big cores. Does tvm.cpu(0) represent 4 LITTLE cores and tvm.cpu(1) represent 4 big cores?

Also, is it possible to check all available CPU device IDs? I noticed this comment:

but when I tried it, it shows an error regarding CL_OUT_OF_HOST_MEMORY:

Thanks.

I do not know the answer, but @tkonolige might

1 Like

If you have dual socket CPU in your machine then with tvm.cpu(0) or tvm.cpu(1) you can target either first or second CPU.

I don’t think id in tvm.cpu(id) corresponds to the core count.

2 Likes

Hello @umangyadav, Thanks for answering.

So for Hikey970 which contains 4 ARM-A53 LITTLE cores and 4 ARM-A73 big cores.

Does tvm.cpu(0) represent 4 LITTLE cores and tvm.cpu(1) represent 4 big cores?

I don’t think so, I am not too much familiar with HiKey970. But it seems it has single SoC. So for both little and big cores, it should be tvm.cpu(0). I think @hogepodge may know better about what tvm.cpu(id) means.

1 Like

Someone should correct me on this if I’m wrong, because I’m definitely not an authority, but it really depends on the device. As far as I can tell setting a device ID on a CPU device does nothing. When you compare the CPU runtime to the CUDA runtime, it looks like the device ID is unused.

1 Like

Thanks for all the replies. Now It seems that changing them doesn’t affect my result. But I will try again and report here.

@hogepodge is largely correct, in terms of checking how device_id is used in the corresponding device-api.

In our particular case, in CPUDeviceAPI, it doesnt affect anything other than the index of the memory pool. Usually sticking around with device_id=0 is good enough

3 Likes