Fix shape mismatch when handling reshape in SPMD partitioner.
Fix shape mismatch when handling reshape in SPMD partitioner.

1. Move shape check for reshape from `HloInstruction::CreateShape` into the constructor, so that illegal reshape is caught at creation time from clone.
2. Enhance `hlo_sharding_util::ReshapeSharding`. It can handle the cases where
* `source_shape_size % source_tile_size == 0`
* `source_shape_size % target_shape_size == 0`
* `(source_tile_size % target_shape_size != 0) || (target_shape_size % source_tile_size != 0)`
3. Enhance `SpmdPartitioningVisitor::HandleReshape`. Unify the two cases in one lambda function. It attempts the original output sharding and then the desired output sharding.

FUTURE_COPYBARA_INTEGRATE_REVIEW=https://github.com/openxla/xla/pull/12154 from philipphack:u_fp8_scale_xla c7944fc3b2b7fdc45a06d058dea856fff2bd7e15
