inductor: using int64 as index dtype for slice_scatter (#103511)
For the given test case from HF AllenaiLongformerBase, there has an accuracy issue for the dynamic shape case, the reason is that we are using int32 as the index type but there has a default value ```9223372036854775807``` out of range of int32, see the IR:
```
def masked_subblock1(self, ops):
get_index = self.get_index('index1')
index_expr = ops.index_expr(get_index, torch.int32)
get_index_1 = self.get_index('index2')
index_expr_1 = ops.index_expr(get_index_1, torch.int32)
ge = ops.ge(index_expr, index_expr_1)
get_index_2 = self.get_index('index1')
index_expr_2 = ops.index_expr(get_index_2, torch.int32)
constant = ops.constant(9223372036854775807, torch.int32)
lt = ops.lt(index_expr_2, constant)
and_ = ops.and_(ge, lt)
masked_subblock2 = self.masked_subblock2(and_, 0.0)
get_index_3 = self.get_index('index4')
load = ops.load('arg4_1', get_index_3)
where = ops.where(and_, masked_subblock2, load)
return where
```
and the CPU codegen will generate the cpp code according to the node type:
```
auto tmp3 = [&]
{
auto tmp4 = static_cast<int>(i3);
auto tmp5 = static_cast<int>(ks2);
auto tmp6 = tmp4 >= tmp5;
auto tmp7 = static_cast<int>(9223372036854775807);
auto tmp8 = tmp4 < tmp7;
auto tmp9 = tmp6 & tmp8;
auto tmp10 = [&]
{
auto tmp11 = in_ptr0[static_cast<long>(i2 + i3 + ((-1L)*ks2) + (i1*ks3) + (2L*i2*ks2) + (3L*i0*ks3) + (2L*i1*ks2*ks3) + ( 6L*i0*ks2*ks3))];
return tmp11;
}
;
auto tmp12 = tmp9 ? tmp10() : static_cast<decltype(tmp10())>(0.0);
auto tmp13 = in_ptr1[static_cast<long>(i2 + i3 + (i1*ks2) + (2L*i1*(static_cast<long>(ks2*ks2))) + (2L*i2*ks2) + (i0*ks1*ks2) + (2L*i0*ks1*(static_cast<long>(ks2*ks2))))];
auto tmp14 = tmp9 ? tmp12 : tmp13;
return tmp14;
}
```
For ```auto tmp7 = static_cast<int>(9223372036854775807);```, ```tmp7``` is always ```-1```, this is wrong.
After This PR, HF AllenaiLongformerBase CPU dynamic shape path can be passed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/103511
Approved by: https://github.com/desertfire