NVIDIA / TransformerEngine

A library for accelerating Transformer models on NVIDIA GPUs, including using 8-bit floating point (FP8) precision on Hopper and Ada GPUs, to provide better performance with lower memory utilization in both training and inference.
https://docs.nvidia.com/deeplearning/transformer-engine/user-guide/index.html
Apache License 2.0
1.61k stars 256 forks source link

Use unoptimized RMSNorm kernel if pointers are not aligned #886

Closed timmoon10 closed 3 weeks ago

timmoon10 commented 1 month ago

Description

The optimimzed RMSNorm kernels access data with vectorized loads/stores, and can thus experience alignment issues if the data pointers are misaligned (e.g. they are views within a larger buffer). This PR falls back to unoptimized kernels (with entry-wise memory accesses) if data pointers are not aligned.

This is the same fix as https://github.com/NVIDIA/TransformerEngine/pull/490.

Type of change

Changes

Checklist:

timmoon10 commented 1 month ago

/te-ci

phu0ngng commented 1 month ago

LGTM! Would you like to add a unit test for this as well?