Introduce value_expr as the dtype-honoring form of index_expr for symbolic
expressions that participate in tensor value computation. A pass classifies
index_expr nodes as indexing or value uses by walking backward from value sinks,
then converts value uses to value_expr in-place. On Triton, value_expr
patches the kernel index dtype and casts the result so arithmetic runs at
the correct width (e.g. int64 for arange(dtype=int64)).
In the future, this should also allow us to no-longer have a "per-kernel" index dtype, but correctly strength reduce particular indexing expressions based on which tensors they are used in.
See, more analysis here https://docs.google.com/document/d/1AdAUkhzd_3qL2SH4kV9AWj2e55yVrNFqbiQP91beQA0/edit?tab=t.0.
Fixes multiple bugs. Note - most of LOC here is just test changes. happy to simplify tests etc as needed.
Authored with Claude.
Pull Request resolved: #185853
Approved by: https://github.com/ezyang
SOCIAL SHARE CARD GENERATOR