There is a bug in TransformerEngine's LayerNormLinear where self.layer_norm_weight may not be fully initialized before the first forward pass due to asynchronous CUDA execution. It can contain garbage values instead of the expected initial values, causing NaNs and other potential issues. We have a workaround in place that sets CUDA_LAUNCH_BLOCKING=1 before the first batch and removes it after to force synchronization on the first batch only. This needs to be removed once the bug is fixed upstream.
There is a bug in TransformerEngine's LayerNormLinear where
self.layer_norm_weightmay not be fully initialized before the first forward pass due to asynchronous CUDA execution. It can contain garbage values instead of the expected initial values, causing NaNs and other potential issues. We have a workaround in place that setsCUDA_LAUNCH_BLOCKING=1before the first batch and removes it after to force synchronization on the first batch only. This needs to be removed once the bug is fixed upstream.