fix functional collective to not generate getattr node (#97924)
use mesh.get_dim_groups directly instead of doing mesh tensor operations
This help us get rid of the getattr ops during tracing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/97924
Approved by: https://github.com/kumpera