OpenCLWorkspace::GetAttr never called?

Hi, I’m currently reading TVM’s code and implementing easy TODOs to learn how TVM works.
I found this TODO which implemented would let TVM to have the correct warp size in OpenCL. After writing some code and debugging. I found that the GetAttr function is never called. Even when an OpenCL target is created and a computation is successfully executed. (I stick a exit(0) at the very beginning of GetAttr and the program does not exit half way trough.)

Further more, seems that kWarpSize is not used in any function call. All appetences of it I can find are either in deceleration or in a case statement.

Here is the code that I use to test stuff: https://gist.github.com/marty1885/264097cc86646778265b48b6c0d87083

IsGetAttr deprecated? Or am I doing something horribly wrong?

My guess is that it is never called, see https://github.com/dmlc/tvm/blob/5fefedcbb62eb2d359e146789f1db40f59c36b68/src/codegen/build_module.cc#L71.

You likely need to find some way to explicitly or indirectly invoke GetAttr to see kWarpSize.

1 Like

You are supposed to use it to query the device info by yourself in the application code, e.g. print(remote.cl().warp_size).

This particular TODO was left by me. Basically we need a way to get the runtime warp size of the device (in this case, Intel Graphics). Also, in the current TVM the warp size (or subgroup size) was set to be 16 in hard-code, a better implementation should allow the subgroup size to be configurable. You are welcome to contribute and thanks for your interest!