puneeth_aditya_5656 fe9107fc73
[mlir][sparse] Implement missing BufferizableOpInterface methods for NewOp (#178423)
## Summary
Fixes crash when running `--eliminate-empty-tensors` on MLIR modules
containing `sparse_tensor.new` with a tensor input.

## Problem
The `sparse_tensor.new` operation was missing the
`bufferizesToMemoryRead`, `bufferizesToMemoryWrite`, and
`getAliasingValues` methods in its `BufferizableOpInterface`
implementation. This caused an `UNREACHABLE` crash with message
"bufferizesToMemoryRead not implemented".

## Solution
Implemented the missing methods in `NewOpInterface`:
- `bufferizesToMemoryRead`: returns `true` (reads from source tensor)
- `bufferizesToMemoryWrite`: returns `false` (doesn't write to source)  
- `getAliasingValues`: returns empty (result is new allocation, not an
alias)

Also added a test case for `sparse_tensor.new` with tensor input.

Fixes #178419

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 07:59:58 +00:00
..