This is done by each op separately, most of them written in python, for example
- tvm/tests/python/unittest/test_tir_ir_builder.py at bef7bf9b2b326488bc2bcc039710b2723023aaa0 · apache/tvm · GitHub.
- tvm/python/tvm/topi/cuda/sort.py at e082ef5f9db89d3f0ff20340717b9d7547a25eaf · apache/tvm · GitHub
Note that the launch param also includes dynamic shmem size. These params that are specified in python are retrieved in split_host_device.cc at tvm/src/tir/transforms/split_host_device.cc at main · apache/tvm · GitHub