[MLIR][XeGPU] Fix XeGPUToXeVM crash on non-integer memref memory spaces (#211053)

## Summary

`convert-xegpu-to-xevm` asserts/crashes when a memref's memory space
isn't an
`IntegerAttr` — e.g. `memref<1024xf32,
#spirv.storage_class<StorageBuffer>>`.
`LoadStoreToXeVMPattern` and `PrefetchToXeVMPattern` compute the LLVM
pointer
address space via the deprecated `MemRefType::getMemorySpaceAsInt()`,
which
asserts on anything but an integer. Memref memory spaces aren't
integer-only
in general (GPU address spaces and XeVM's own `xevm::AddrSpaceAttr` are
both
legal here) — the file's own `isSharedMemRef` already handles this
correctly
elsewhere, these three call sites just didn't.

## Fix

Add `getNumericMemorySpace()`: maps `IntegerAttr` (unchanged, verbatim),
`xevm::AddrSpaceAttr`, and `gpu::AddressSpaceAttr` onto XeVM's numeric
address spaces, and returns `failure()` for anything else so callers
reject
the op via `notifyMatchFailure` instead of asserting. `isSharedMemRef`
now
just calls this helper instead of duplicating the attribute dispatch.

SPIR-V storage classes are deliberately not translated: SPIR-V is a
lowering
target for XeGPU, not a memory space meant to be used alongside the
XeGPU
dialect, so `#spirv.storage_class<...>` falls through to `failure()` and
produces a clean legalization error.

Not using `TypeConverter::addTypeAttributeConversion` since this pass
overrides `MemRefType` conversion to a bare integer r than an LLVM
struct descriptor, so that hook is never consulted.

## Test plan

- The reported repro no longer crashes — it now fails legalization
cleanly
- `failed_conversion.mlir`: added a `#spirv.storage_class<StorageBuff
  case, verifying a legalization failure instead of an assert
- Full XeGPUToXeVM test suite passes

Fixes #210988

GitOrigin-RevId: 286d5c760a7710644ad06f354baa69cec5cc7b72
2 files changed
tree: 72ec07c076768d10c82f123deb9c23a195fa9c41
  1. benchmark/
  2. cmake/
  3. docs/
  4. examples/
  5. include/
  6. lib/
  7. python/
  8. test/
  9. tools/
  10. unittests/
  11. utils/
  12. .clang-format
  13. .clang-tidy
  14. CMakeLists.txt
  15. LICENSE.TXT
  16. Maintainers.md
  17. README.md
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.