XPU now supports MoE kernel(MegaBlocks) implementation
Author: YangKai0616
Pull request: yes

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

XPU now supports the **MoE kernel(MegaBlocks)** implementation, and includes XPU checks for GPT-OSS UTs compatibility.




<!-- Your PR will be replied to more quickly if you can figure out the right person to tag with @

 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- text models: @ArthurZucker @Cyrilvallez
- vision models: @yonigozlan @molbap
- audio models: @eustlb @ebezzam @vasqu
- multimodal models: @zucchini-nlp
- graph models: @clefourrier

Library:

- generate: @zucchini-nlp (visual-language models) or @gante (all others)
- continuous batching: @remi-or @ArthurZucker @McPatate
- pipelines: @Rocketknight1
- tokenizers: @ArthurZucker and @itazap
- trainer: @SunMarc
- attention: @vasqu @ArthurZucker @CyrilVallez
- model loading (from pretrained, etc): @CyrilVallez
- distributed: @3outeille @ArthurZucker
- CIs: @ydshieh

Integrations:

- ray/raytune: @richardliaw, @amogkam
- Big Model Inference: @SunMarc
- quantization: @SunMarc @MekkCyber
- kernels: @MekkCyber @drbh
- peft: @BenjaminBossan @githubnemo

Devices/Backends:

- AMD ROCm: @ivarflakstad
- Intel XPU: @IlyasMoutawwakil
- Ascend NPU: @ivarflakstad 

Documentation: @stevhliu

Research projects are not maintained and should be taken as is.

 -->


Comments:
run-slow: gpt_oss

View the CircleCI Test Summary for this PR:

https://huggingface.co/spaces/transformers-community/circle-ci-viz?pr=43435&sha=979358

Hi @ydshieh, please help review, thanks!

Hi @ydshieh , feel free to reach out if you have any questions!

@MekkCyber please help review


1. Ran command `python3 run_benchmarks.py --model-id openai/gpt-oss-20b  --batch-size 2  --num-tokens-to-generate 256 --level 0 --sequence-length 256 --warmup 1 --iterations 1 --no-gpu-monitoring` on XPU. Test results are as follows:

**eager expert**:
```
Config: 1 warmup, 1 iterations, no GPU monitoring, batch size 2, sequence length 256, 256 generated tokens, eager attention, not compiled, kernelized, experts_eager, regular generate
 
  E2E Latency.........: avg=29.67s     std=0.00ns    min=29.67s     med=29.67s     max=29.67s     p95=29.67s
  Time to First Token.: avg=500.00ms   std=0.00ns    min=500.00ms   med=500.00ms   max=500.00ms   p95=500.00ms
  Inter-Token Latency.: avg=113.77ms   std=0.00ns    min=113.77ms   med=113.77ms   max=113.77ms   p95=113.77ms
  Throughput..........: avg=17.26tok/s std=0.00tok/s min=17.26tok/s med=17.26tok/s max=17.26tok/s p95=17.26tok/s
```
**grouped_mm expert**:
```
Config: 1 warmup, 1 iterations, no GPU monitoring, batch size 2, sequence length 256, 256 generated tokens, eager attention, not compiled, kernelized, experts_grouped_mm, regular generate
 
  E2E Latency.........: avg=12.25s     std=0.00ns    min=12.25s     med=12.25s     max=12.25s     p95=12.25s
  Time to First Token.: avg=250.00ms   std=0.00ns    min=250.00ms   med=250.00ms   max=250.00ms   p95=250.00ms
  Inter-Token Latency.: avg=46.88ms    std=0.00ns    min=46.88ms    med=46.88ms    max=46.88ms    p95=46.88ms
  Throughput..........: avg=41.80tok/s std=0.00tok/s min=41.80tok/s med=41.80tok/s max=41.80tok/s p95=41.80tok/s
```
**kernels expert**:
```
Config: 1 warmup, 1 iterations, no GPU monitoring, batch size 2, sequence length 256, 256 generated tokens, eager attention, not compiled, kernelized, experts_grouped_mm, regular generate
 
  E2E Latency.........: avg=9.86s      std=0.00ns    min=9.86s      med=9.86s      max=9.86s      p95=9.86s
  Time to First Token.: avg=125.00ms   std=0.00ns    min=125.00ms   med=125.00ms   max=125.00ms   p95=125.00ms
  Inter-Token Latency.: avg=38.09ms    std=0.00ns    min=38.09ms    med=38.09ms    max=38.09ms    p95=38.09ms
  Throughput..........: avg=51.93tok/s std=0.00tok/s min=51.93tok/s med=51.93tok/s max=51.93tok/s p95=51.93tok/s
```

The results show that the `kernel` version perf is significantly better than the `eager` implementation, and it also outperforms `grouped_mm`. The `batched_mm` test encountered OOM, and I have not investigated the exact reason yet.

2. `difflib` has been removed.

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_43435). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

**[For maintainers]** Suggested jobs to run (before merge)

run-slow: gpt_oss