"invalid arguments" when many control flows control flow limits

No, the kernel works well when the dataset is small, say ,1k. when the input dataset is 1M, it works wrong. but indeed there’s nothing related with the dataset??

Hi, I meet invalide arguments error in kernel. If I comment some random control flow blocks, e.g. a for loop, a device subfunction, then the kernel passes.
I want to ask: is there a limitation for max control flows? Thanks!