Skip to content

[JAX] Support SP + RoPE + GeLU - #602

Merged
denera merged 20 commits into
NVIDIA:mainfrom
mingxu1067:mingh/sp_rope_gelu
Feb 2, 2024
Merged

[JAX] Support SP + RoPE + GeLU#602
denera merged 20 commits into
NVIDIA:mainfrom
mingxu1067:mingh/sp_rope_gelu

Conversation

@mingxu1067

Copy link
Copy Markdown
Collaborator
  • Support Sqeuence Parallelism
  • Support Rotary Position Embedding (RoPE).
  • Port GeLU relevant custom calls.

Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
…f with nn.scan.
Signed-off-by: Ming Huang <mingh@nvidia.com>

@nouiznouiz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First round of review.

Comment threadtests/jax/test_praxis_layers.py
Comment threadtransformer_engine/jax/csrc/modules.cpp Outdated
Comment threadtransformer_engine/jax/praxis/transformer.py Outdated
Comment threadtests/jax/test_custom_call_compute.py
Comment threadtests/jax/test_custom_call_compute.py Outdated
Comment threadtests/jax/test_custom_call_compute.py
Comment threadtests/jax/test_custom_call_compute.py
Comment threadtests/jax/test_custom_call_compute.py Outdated
Comment threadtransformer_engine/jax/flax/transformer.py Outdated
Comment threadtransformer_engine/jax/flax/transformer.py
Signed-off-by: Ming Huang <mingh@nvidia.com>
@zlsh80826
zlsh80826 self-requested a review January 17, 2024 07:08
@zlsh80826

Copy link
Copy Markdown
Collaborator

LGTM

Comment threadtransformer_engine/jax/flax/transformer.py Outdated
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
Signed-off-by: Ming Huang <mingh@nvidia.com>
@zlsh80826
zlsh80826 self-requested a review January 19, 2024 09:15
Comment threadtests/jax/utils.py Outdated
Comment threadtransformer_engine/jax/layernorm.py Outdated
Comment threadtransformer_engine/jax/sharding.py

@nouiznouiz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update one of the example to show SP?
A simple modification, like just a parameter to the example to use or not SP would be great.

Comment threadtransformer_engine/jax/flax/module.py
Comment threadtransformer_engine/jax/flax/module.py
Comment threadtransformer_engine/jax/flax/module.py
Comment threadtransformer_engine/jax/layernorm.py Outdated
Comment threadtransformer_engine/jax/layernorm.py
Comment threadtransformer_engine/jax/flax/transformer.py
Comment threadtransformer_engine/jax/sharding.py
Comment threadtransformer_engine/jax/sharding.py
jnp.asarray(ref_s_grad, np.float32),
dtype=FP8Helper.BWD_DTYPE)

@pytest.mark.skipif(not is_fp8_supported, reason=reason)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any test for vmap?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not implemented yet, but tests of vmap is orthogonal to this PR. We can schedule time to submit another PR to do so.

Signed-off-by: Ming Huang <mingh@nvidia.com>
@mingxu1067

Copy link
Copy Markdown
CollaboratorAuthor

Can you update one of the example to show SP? A simple modification, like just a parameter to the example to use or not SP would be great.

Done, refer to examples/jax/encoder/test_model_parallel_encoder.py

Comment threadexamples/jax/encoder/test_model_parallel_encoder.py
Comment threaddocs/api/jax.rst Outdated
Comment threaddocs/api/jax.rst Outdated
Signed-off-by: Ming Huang <mingh@nvidia.com>
@denera

Copy link
Copy Markdown
Collaborator

/te-ci jax

@mingxu1067

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci

Signed-off-by: Ming-Xu Huang <mingh@nvidia.com>
Signed-off-by: Ming-Xu Huang <mingh@nvidia.com>
Signed-off-by: Ming-Xu Huang <mingh@nvidia.com>
@mingxu1067

Copy link
Copy Markdown
CollaboratorAuthor

/te-ci jax

@denera

Copy link
Copy Markdown
Collaborator

@ashors1 verified partial convergence and Abhinav Goal verified performance. Merging PR -- thank you for the hard work @mingxu1067!

@denera
denera merged commit ce163f9 into NVIDIA:mainFeb 2, 2024
@irhumirhum mentioned this pull request Mar 10, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@mingxu1067@zlsh80826@denera@nouiz