[all-commits] [llvm/llvm-project] 286d5c: [MLIR][XeGPU] Fix XeGPUToXeVM crash on non-integer...

Hamza Qureshi via All-commits all-commits at lists.llvm.org
Wed Aug 5 11:51:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 286d5c760a7710644ad06f354baa69cec5cc7b72
      https://github.com/llvm/llvm-project/commit/286d5c760a7710644ad06f354baa69cec5cc7b72
  Author: Hamza Qureshi <63870077+hamzaqureshi5 at users.noreply.github.com>
  Date:   2026-08-05 (Wed, 05 Aug 2026)

  Changed paths:
    M mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp
    M mlir/test/Conversion/XeGPUToXeVM/failed_conversion.mlir

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list