Repository: pytorch
Issue: Matmul with int32 parameters on Intel GPU leads to errors
Labels: triaged,module: xpu

### 🐛 Describe the bug

torch.matmul with int32 parameters leads to errors, when running on XPU (Intel GPU)  in the following program.


```python
import numpy as np
import torch

class Model(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.val = torch.nn.Parameter(torch.ones([1], dtype=torch.int32), requires_grad=False)

    def forward(self, *args):
        val = self.val
        out = torch.matmul(val, args[0])
        return (out)

m = Model()

inp = [np.ones([1,1], np.int32)]

m.to('cpu')
output1 = m(*[torch.from_numpy(v).to('cpu') for v in inp])
print(output1)

m.to('xpu')
output2 = m(*[torch.from_numpy(v).to('xpu') for v in inp])
print(output2)
````

### **Error Logs**
```bash
tensor([1], dtype=torch.int32)
Traceback (most recent call last):
  File "/xxx/test.py", line 23, in <module>
    output2 = m(*[torch.from_numpy(v).to('xpu') for v in inp])
  File "/home/xxx/anaconda3/envs/intel-gpu-pytorch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1736, in _wrapped_call_impl
    return self._call_impl(*args, **kwargs)
  File "/home/xxx/anaconda3/envs/intel-gpu-pytorch/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1747, in _call_impl
    return forward_call(*args, **kwargs)
  File "/xxx/test.py", line 11, in forward
    out = torch.matmul(val, args[0])
RuntimeError: could not create a primitive descriptor for a matmul primitive
```

### Versions

PyTorch version: 2.5.1+xpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 24.04.1 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.39

Python version: 3.10.16 | packaged by conda-forge | (main, Dec  5 2024, 14:16:10) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.39
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Address sizes:                        46 bits physical, 48 bits virtual
Byte Order:                           Little Endian
CPU(s):                               18
On-line CPU(s) list:                  0-17
Vendor ID:                            GenuineIntel
Model name:                           Intel(R) Core(TM) Ultra 5 125H
CPU family:                           6
Model:                                170
Thread(s) per core:                   2
Core(s) per socket:                   9
Socket(s):                            1
Stepping:                             4
BogoMIPS:                             5990.40
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtop
ology tsc_reliable nonstop_tsc cpuid pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_sin
gle ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
Virtualization:                       VT-x
Hypervisor vendor:                    Microsoft
Virtualization type:                  full
L1d cache:                            432 KiB (9 instances)
L1i cache:                            576 KiB (9 instances)
L2 cache:                             18 MiB (9 instances)
L3 cache:                             18 MiB (1 instance)
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

Versions of relevant libraries:
[pip3] numpy==2.1.3
[pip3] onnx==1.17.0
[pip3] onnxruntime==1.20.1
[pip3] onnxscript==0.1.0.dev20241211
[pip3] pytorch-triton-xpu==3.1.0
[pip3] torch==2.5.1+xpu
[pip3] torchaudio==2.5.1+xpu
[pip3] torchvision==0.20.1+xpu
[conda] numpy                     2.1.3                    pypi_0    pypi
[conda] pytorch-triton-xpu        3.1.0                    pypi_0    pypi
[conda] torch                     2.5.1+xpu                pypi_0    pypi
[conda] torchaudio                2.5.1+xpu                pypi_0    pypi
[conda] torchvision               0.20.1+xpu               pypi_0    pypi


cc @gujinghui @EikanWang @fengyuan14 @guangyey